diff --git a/DecompilerNuGetDemos.workbook b/DecompilerNuGetDemos.workbook index e0629fbc7..0d4e3d504 100644 --- a/DecompilerNuGetDemos.workbook +++ b/DecompilerNuGetDemos.workbook @@ -6,7 +6,7 @@ platforms: - DotNetCore packages: - id: ICSharpCode.Decompiler - version: 5.0.0.5066-preview4 + version: 5.0.0.5124 --- Setup: load the references required to work with the decompiler diff --git a/ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj b/ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj index f207dfe1f..5f3e7a298 100644 --- a/ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj +++ b/ICSharpCode.Decompiler.Console/ICSharpCode.Decompiler.Console.csproj @@ -7,7 +7,7 @@ true ilspycmd ilspycmd - 5.0.0-preview4 + 5.0.0.5124 Command-line decompiler using the ILSpy decompilation engine Copyright 2011-2019 AlphaSierraPapa https://github.com/icsharpcode/ILSpy/ @@ -28,7 +28,7 @@ - + diff --git a/ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj b/ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj index 3477b5693..4b621af3b 100644 --- a/ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj +++ b/ICSharpCode.Decompiler.PowerShell/ICSharpCode.Decompiler.PowerShell.csproj @@ -8,7 +8,7 @@ - + diff --git a/ICSharpCode.Decompiler.Tests/Helpers/Tester.cs b/ICSharpCode.Decompiler.Tests/Helpers/Tester.cs index 1ad55293d..250b2f1ef 100644 --- a/ICSharpCode.Decompiler.Tests/Helpers/Tester.cs +++ b/ICSharpCode.Decompiler.Tests/Helpers/Tester.cs @@ -183,20 +183,21 @@ namespace ICSharpCode.Decompiler.Tests.Helpers } static readonly string refAsmPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), - @"Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2"); + @"Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2"); static readonly string thisAsmPath = Path.GetDirectoryName(typeof(Tester).Assembly.Location); static readonly Lazy> defaultReferences = new Lazy>(delegate { return new[] { + MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "Facades\\netstandard.dll")), MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "mscorlib.dll")), - MetadataReference.CreateFromFile(Path.Combine(thisAsmPath, "netstandard.dll")), MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "System.dll")), MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "System.Core.dll")), MetadataReference.CreateFromFile(Path.Combine(refAsmPath, @"Facades\System.Runtime.dll")), MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "System.Xml.dll")), MetadataReference.CreateFromFile(Path.Combine(refAsmPath, "Microsoft.CSharp.dll")), MetadataReference.CreateFromFile(typeof(ValueTuple).Assembly.Location), + MetadataReference.CreateFromFile(typeof(ValueTask).Assembly.Location), MetadataReference.CreateFromFile(typeof(Span<>).Assembly.Location), }; }); diff --git a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj index fe066f25f..1f7b27189 100644 --- a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj +++ b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj @@ -2,7 +2,7 @@ - net462 + net472 7.3 True @@ -81,6 +81,7 @@ + diff --git a/ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs b/ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs index 72e16db69..a709794f8 100644 --- a/ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs +++ b/ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs @@ -154,6 +154,12 @@ namespace ICSharpCode.Decompiler.Tests Run(); } + [Test] + public void Issue1681() + { + Run(); + } + [Test] public void Issue1454() { diff --git a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs index 401c23221..4a34baaf9 100644 --- a/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs +++ b/ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs @@ -284,7 +284,9 @@ namespace ICSharpCode.Decompiler.Tests [Test] public void VariableNamingWithoutSymbols([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions) { - RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings { UseDebugSymbols = false }); + var settings = Tester.GetSettings(cscOptions); + settings.UseDebugSymbols = false; + RunForLibrary(cscOptions: cscOptions, decompilerSettings: settings); } [Test] @@ -299,6 +301,12 @@ namespace ICSharpCode.Decompiler.Tests Run(cscOptions: cscOptions); } + [Test] + public void CustomTaskType([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions) + { + RunForLibrary(cscOptions: cscOptions); + } + [Test] public void NullableRefTypes([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions) { diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1389.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1389.cs index 00d6d297d..e2ee2eb3d 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1389.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1389.cs @@ -12,7 +12,7 @@ namespace Issue1389 private static void UnusedResultOfIsinst() { - bool flag = GetObject() is TypeCode; + _ = (GetObject() is TypeCode); } private static bool BoolResultOfIsinst() diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1681.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1681.cs new file mode 100644 index 000000000..31ea4c132 --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1681.cs @@ -0,0 +1,15 @@ +namespace ICSharpCode.Decompiler.Tests.TestCases.ILPretty +{ + internal class BaseClass + { + public int importsClausePosition; + } + + internal class Issue1681 : BaseClass + { + public void Test() + { + _ = importsClausePosition; + } + } +} diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1681.il b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1681.il new file mode 100644 index 000000000..d3e5c2416 --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/Issue1681.il @@ -0,0 +1,42 @@ +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly ConsoleApp11 +{ + .ver 1:0:0:0 +} +.module ConsoleApp11.exe +// MVID: {B973FCD6-A9C4-48A9-8291-26DDC248E208} +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00020003 // ILONLY 32BITPREFERRED +// Image base: 0x000001C4B6C90000 + +.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.ILPretty.BaseClass + extends [mscorlib]System.Object +{ + +.field public int32 importsClausePosition + +} + +.class private auto ansi beforefieldinit ICSharpCode.Decompiler.Tests.TestCases.ILPretty.Issue1681 + extends ICSharpCode.Decompiler.Tests.TestCases.ILPretty.BaseClass +{ + +.method public hidebysig instance void Test() cil managed +{ + // Code size 18 (0x12) + .maxstack 8 + ldarg.0 + ldfld int32 class ICSharpCode.Decompiler.Tests.TestCases.ILPretty.BaseClass::importsClausePosition + pop + ret +} // end of method Issue1681::Test + +} \ No newline at end of file diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomTaskType.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomTaskType.cs new file mode 100644 index 000000000..65309ac46 --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/CustomTaskType.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty +{ + public class CustomTaskType + { + private int memberField; + + public async ValueTask SimpleVoidTaskMethod() + { + Console.WriteLine("Before"); + await Task.Delay(TimeSpan.FromSeconds(1.0)); + Console.WriteLine("After"); + } + + public async ValueTask TaskMethodWithoutAwait() + { + Console.WriteLine("No Await"); + } + + public async ValueTask CapturingThis() + { + await Task.Delay(memberField); + } + + public async ValueTask CapturingThisWithoutAwait() + { + Console.WriteLine(memberField); + } + + public async ValueTask SimpleBoolTaskMethod() + { + Console.WriteLine("Before"); + await Task.Delay(TimeSpan.FromSeconds(1.0)); + Console.WriteLine("After"); + return true; + } + + public async void TwoAwaitsWithDifferentAwaiterTypes() + { + Console.WriteLine("Before"); + if (await SimpleBoolTaskMethod()) { + await Task.Delay(TimeSpan.FromSeconds(1.0)); + } + Console.WriteLine("After"); + } + + public async void AwaitInLoopCondition() + { + while (await SimpleBoolTaskMethod()) { + Console.WriteLine("Body"); + } + } + + public async ValueTask AwaitInCatch(bool b, ValueTask task1, ValueTask task2) + { + try { + Console.WriteLine("Start try"); + await task1; + Console.WriteLine("End try"); + } catch (Exception) { + if (!b) { + await task2; + } else { + Console.WriteLine("No await"); + } + } + } + + public async ValueTask AwaitInFinally(bool b, ValueTask task1, ValueTask task2) + { + try { + Console.WriteLine("Start try"); + await task1; + Console.WriteLine("End try"); + } finally { + if (!b) { + await task2; + } else { + Console.WriteLine("No await"); + } + } + } + + public static async ValueTask GetIntegerSumAsync(IEnumerable items) + { + await Task.Delay(100); + int num = 0; + foreach (int item in items) { + num += item; + } + return num; + } + + public static Func> AsyncLambda() + { + return async () => await GetIntegerSumAsync(new int[3] { + 1, + 2, + 3 + }); + } + + public static Func> AsyncDelegate() + { + return async delegate { + await Task.Delay(10); + return 2; + }; + } + + public static async ValueTask AsyncLocalFunctions() + { + return await Nested(1) + await Nested(2); + + async ValueTask Nested(int i) + { + await Task.Delay(i); + return i; + } + } + } +} diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/FixProxyCalls.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/FixProxyCalls.cs index 92976953b..6b48c4f9b 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/FixProxyCalls.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/FixProxyCalls.cs @@ -114,6 +114,23 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.ILPretty } } + public class Issue1660 : Issue1660Base + { + public Action M(object state) + { + return delegate(object x) { + base.BaseCall(x, state, (Func)(() => null)); + }; + } + } + + public class Issue1660Base + { + protected virtual void BaseCall(object x, object state, Func action) + { + } + } + internal class J : I { protected internal override void Test(int a) diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.cs index 874769b9b..1c99c6ed4 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.cs @@ -1192,5 +1192,22 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty throw new ArgumentOutOfRangeException(); } } + + public static bool DoNotRemoveAssignmentBeforeSwitch(string x, out ConsoleKey key) + { + key = (ConsoleKey)0; + switch (x) { + case "A": + key = ConsoleKey.A; + break; + case "B": + key = ConsoleKey.B; + break; + case "C": + key = ConsoleKey.C; + break; + } + return key != (ConsoleKey)0; + } } } \ No newline at end of file diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.cs index 118e2a144..2993b179a 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/TypeAnalysisTests.cs @@ -276,5 +276,15 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { return AttributeTargets.All.HasFlag(AttributeTargets.Assembly); } + + public static string ImpossibleCast1(int i) + { + return (string)(object)i; + } + + public static string ImpossibleCast2(Action a) + { + return (string)(object)a; + } } } diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.cs index 346c3b13e..322b34c95 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/ValueTypes.cs @@ -273,5 +273,10 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { Get().Field.ToString(); } + + public static string CallOnIntegerConstant() + { + return ulong.MaxValue.ToString(); + } } } \ No newline at end of file diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNaming.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNaming.cs index 19ca0c8e1..169299791 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNaming.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNaming.cs @@ -10,12 +10,20 @@ private void Test(string text, C c) { +#if ROSLYN + _ = c.Name; +#else string name = c.Name; +#endif } private void Test2(string text, C c) { +#if ROSLYN + _ = c.Text; +#else string text2 = c.Text; +#endif } } } diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNamingWithoutSymbols.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNamingWithoutSymbols.cs index 9e9654962..fbb7831a0 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNamingWithoutSymbols.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNamingWithoutSymbols.cs @@ -10,12 +10,20 @@ private void Test(string text, C c) { +#if ROSLYN + _ = c.Name; +#else string name = c.Name; +#endif } private void Test2(string text, C c) { +#if ROSLYN + _ = c.Text; +#else string text2 = c.Text; +#endif } } } diff --git a/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs b/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs index 994be0c13..276b5bbdb 100644 --- a/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs +++ b/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs @@ -1164,6 +1164,8 @@ namespace ICSharpCode.Decompiler.CSharp EnumValueDisplayMode DetectBestEnumValueDisplayMode(ITypeDefinition typeDef, PEFile module) { + if (settings.AlwaysShowEnumMemberValues) + return EnumValueDisplayMode.All; if (typeDef.HasAttribute(KnownAttribute.Flags, inherit: false)) return EnumValueDisplayMode.All; bool first = true; diff --git a/ICSharpCode.Decompiler/CSharp/CallBuilder.cs b/ICSharpCode.Decompiler/CSharp/CallBuilder.cs index c765b12d4..ad581e53e 100644 --- a/ICSharpCode.Decompiler/CSharp/CallBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/CallBuilder.cs @@ -1294,7 +1294,7 @@ namespace ICSharpCode.Decompiler.CSharp if (thisArgBox.Argument is LdObj ldobj) { thisArg = ldobj.Target; } else { - thisArg = new AddressOf(thisArgBox.Argument); + thisArg = new AddressOf(thisArgBox.Argument, thisArgBox.Type); } } target = expressionBuilder.TranslateTarget(thisArg, diff --git a/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs b/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs index 239d84976..0d7d7b9c6 100644 --- a/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs @@ -188,6 +188,11 @@ namespace ICSharpCode.Decompiler.CSharp } internal bool HidesVariableWithName(string name) + { + return HidesVariableWithName(currentFunction, name); + } + + internal static bool HidesVariableWithName(ILFunction currentFunction, string name) { return currentFunction.Ancestors.OfType().Any(HidesVariableOrNestedFunction); @@ -2769,14 +2774,9 @@ namespace ICSharpCode.Decompiler.CSharp protected internal override TranslatedExpression VisitAddressOf(AddressOf inst, TranslationContext context) { - IType targetTypeHint = null; - if (context.TypeHint is ByReferenceType brt) { - targetTypeHint = brt.ElementType; - } else if (context.TypeHint is PointerType pt) { - targetTypeHint = pt.ElementType; - } // HACK: this is only correct if the argument is an R-value; otherwise we're missing the copy to the temporary - var value = Translate(inst.Value, targetTypeHint); + var value = Translate(inst.Value, inst.Type); + value = value.ConvertTo(inst.Type, this); return new DirectionExpression(FieldDirection.Ref, value) .WithILInstruction(inst) .WithRR(new ByReferenceResolveResult(value.ResolveResult, ReferenceKind.Ref)); diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs index 02416b7e0..589f1042c 100644 --- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs @@ -206,13 +206,18 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax if (type == null) throw new ArgumentNullException("type"); AstType astType = ConvertTypeHelper(type); + AddTypeAnnotation(astType, type); + return astType; + } + + private void AddTypeAnnotation(AstType astType, IType type) + { if (AddTypeReferenceAnnotations) astType.AddAnnotation(type); if (AddResolveResultAnnotations) astType.AddAnnotation(new TypeResolveResult(type)); - return astType; } - + public AstType ConvertType(FullTypeName fullTypeName) { if (resolver != null) { @@ -235,11 +240,10 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } return type; } - + AstType ConvertTypeHelper(IType type) { - TypeWithElementType typeWithElementType = type as TypeWithElementType; - if (typeWithElementType != null) { + if (type is TypeWithElementType typeWithElementType) { if (typeWithElementType is PointerType) { return ConvertType(typeWithElementType.ElementType).MakePointerType(); } else if (typeWithElementType is ArrayType) { @@ -254,20 +258,12 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax // not supported as type in C# return ConvertType(typeWithElementType.ElementType); } - } - if (type is ParameterizedType pt) { - if (AlwaysUseBuiltinTypeNames && pt.IsKnownType(KnownTypeCode.NullableOfT)) { - return ConvertType(pt.TypeArguments[0]).MakeNullableType(); - } - return ConvertTypeHelper(pt.GenericType, pt.TypeArguments); - } - if (type is NullabilityAnnotatedType nat) { + } else if (type is NullabilityAnnotatedType nat) { var astType = ConvertType(nat.TypeWithoutAnnotation); if (nat.Nullability == Nullability.Nullable) astType = astType.MakeNullableType(); return astType; - } - if (type is TupleType tuple) { + } else if (type is TupleType tuple) { var astType = new TupleAstType(); foreach (var (etype, ename) in tuple.ElementTypes.Zip(tuple.ElementNames)) { astType.Elements.Add(new TupleTypeElement { @@ -276,23 +272,35 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax }); } return astType; - } - if (type is ITypeDefinition typeDef) { - if (ShowTypeParametersForUnboundTypes) - return ConvertTypeHelper(typeDef, typeDef.TypeArguments); - if (typeDef.TypeParameterCount > 0) { - // Unbound type - IType[] typeArguments = new IType[typeDef.TypeParameterCount]; - for (int i = 0; i < typeArguments.Length; i++) { - typeArguments[i] = SpecialType.UnboundTypeArgument; + } else { + AstType astType; + if (type is ITypeDefinition typeDef) { + if (ShowTypeParametersForUnboundTypes) { + astType = ConvertTypeHelper(typeDef, typeDef.TypeArguments); + } else if (typeDef.TypeParameterCount > 0) { + // Unbound type + IType[] typeArguments = new IType[typeDef.TypeParameterCount]; + for (int i = 0; i < typeArguments.Length; i++) { + typeArguments[i] = SpecialType.UnboundTypeArgument; + } + astType = ConvertTypeHelper(typeDef, typeArguments); + } else { + astType = ConvertTypeHelper(typeDef, EmptyList.Instance); + } + } else if (type is ParameterizedType pt) { + if (AlwaysUseBuiltinTypeNames && pt.IsKnownType(KnownTypeCode.NullableOfT)) { + return ConvertType(pt.TypeArguments[0]).MakeNullableType(); } - return ConvertTypeHelper(typeDef, typeArguments); + astType = ConvertTypeHelper(pt.GenericType, pt.TypeArguments); } else { - return ConvertTypeHelper(typeDef, EmptyList.Instance); + astType = MakeSimpleType(type.Name); } - + if (type.Nullability == Nullability.Nullable) { + AddTypeAnnotation(astType, type.ChangeNullability(Nullability.Oblivious)); + astType = astType.MakeNullableType(); + } + return astType; } - return MakeSimpleType(type.Name); } AstType ConvertTypeHelper(IType genericType, IReadOnlyList typeArguments) @@ -304,11 +312,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax if (AlwaysUseBuiltinTypeNames && typeDef != null) { string keyword = KnownTypeReference.GetCSharpNameByTypeCode(typeDef.KnownTypeCode); if (keyword != null) { - if (genericType.Nullability == Nullability.Nullable) { - return new PrimitiveType(keyword).MakeNullableType(); - } else { - return new PrimitiveType(keyword); - } + return new PrimitiveType(keyword); } } @@ -352,11 +356,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax if (AlwaysUseShortTypeNames || (typeDef == null && genericType.DeclaringType == null)) { var shortResult = MakeSimpleType(genericType.Name); AddTypeArguments(shortResult, genericType.TypeParameters, typeArguments, outerTypeParameterCount, genericType.TypeParameterCount); - if (genericType.Nullability == Nullability.Nullable) { - return shortResult.MakeNullableType(); - } else { - return shortResult; - } + return shortResult; } MemberType result = new MemberType(); if (genericType.DeclaringType != null) { @@ -375,11 +375,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } result.MemberName = genericType.Name; AddTypeArguments(result, genericType.TypeParameters, typeArguments, outerTypeParameterCount, genericType.TypeParameterCount); - if (genericType.Nullability == Nullability.Nullable) { - return result.MakeNullableType(); - } else { - return result; - } + return result; } /// @@ -604,11 +600,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax } else if (resolver != null) { ApplyShortAttributeNameIfPossible(type, astType, shortName); } + AddTypeAnnotation(astType, type); - if (AddTypeReferenceAnnotations) - astType.AddAnnotation(type); - if (AddResolveResultAnnotations) - astType.AddAnnotation(new TypeResolveResult(type)); return astType; } diff --git a/ICSharpCode.Decompiler/CSharp/Transforms/ConvertConstructorCallIntoInitializer.cs b/ICSharpCode.Decompiler/CSharp/Transforms/ConvertConstructorCallIntoInitializer.cs index b87bf717a..e3416ccbd 100644 --- a/ICSharpCode.Decompiler/CSharp/Transforms/ConvertConstructorCallIntoInitializer.cs +++ b/ICSharpCode.Decompiler/CSharp/Transforms/ConvertConstructorCallIntoInitializer.cs @@ -58,18 +58,20 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms public override void VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration) { - ExpressionStatement stmt = constructorDeclaration.Body.Statements.FirstOrDefault() as ExpressionStatement; + var stmt = constructorDeclaration.Body.Statements.FirstOrDefault() as ExpressionStatement; if (stmt == null) return; - InvocationExpression invocation = stmt.Expression as InvocationExpression; - if (invocation == null) + if (!(stmt.Expression is InvocationExpression invocation)) return; - MemberReferenceExpression mre = invocation.Target as MemberReferenceExpression; - if (mre != null && mre.MemberName == ".ctor") { + if (invocation.Target is MemberReferenceExpression mre && mre.MemberName == ".ctor") { ConstructorInitializer ci = new ConstructorInitializer(); - if (mre.Target is ThisReferenceExpression) + var target = mre.Target; + // Ignore casts, those might be added if references are missing. + if (target is CastExpression cast) + target = cast.Expression; + if (target is ThisReferenceExpression) ci.ConstructorInitializerType = ConstructorInitializerType.This; - else if (mre.Target is BaseReferenceExpression) + else if (target is BaseReferenceExpression) ci.ConstructorInitializerType = ConstructorInitializerType.Base; else return; diff --git a/ICSharpCode.Decompiler/CSharp/Transforms/DeclareVariables.cs b/ICSharpCode.Decompiler/CSharp/Transforms/DeclareVariables.cs index c9310107a..a3b5168c5 100644 --- a/ICSharpCode.Decompiler/CSharp/Transforms/DeclareVariables.cs +++ b/ICSharpCode.Decompiler/CSharp/Transforms/DeclareVariables.cs @@ -180,16 +180,23 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms if (!IsValidInStatementExpression(stmt.Expression)) { // fetch ILFunction var function = stmt.Ancestors.SelectMany(a => a.Annotations.OfType()).First(f => f.Parent == null); - // assign result to dummy variable - var type = stmt.Expression.GetResolveResult().Type; - var v = function.RegisterVariable( - VariableKind.StackSlot, - type, - AssignVariableNames.GenerateVariableName(function, type, stmt.Expression.Annotations.OfType().Where(AssignVariableNames.IsSupportedInstruction).FirstOrDefault()) - ); - stmt.Expression = new AssignmentExpression( - new IdentifierExpression(v.Name).WithRR(new ILVariableResolveResult(v, v.Type)), - stmt.Expression.Detach()); + // if possible use C# 7.0 discard-assignment + if (context.Settings.Discards && !ExpressionBuilder.HidesVariableWithName(function, "_")) { + stmt.Expression = new AssignmentExpression( + new IdentifierExpression("_"), // no ResolveResult + stmt.Expression.Detach()); + } else { + // assign result to dummy variable + var type = stmt.Expression.GetResolveResult().Type; + var v = function.RegisterVariable( + VariableKind.StackSlot, + type, + AssignVariableNames.GenerateVariableName(function, type, stmt.Expression.Annotations.OfType().Where(AssignVariableNames.IsSupportedInstruction).FirstOrDefault()) + ); + stmt.Expression = new AssignmentExpression( + new IdentifierExpression(v.Name).WithRR(new ILVariableResolveResult(v, v.Type)), + stmt.Expression.Detach()); + } } } } diff --git a/ICSharpCode.Decompiler/CSharp/TranslatedExpression.cs b/ICSharpCode.Decompiler/CSharp/TranslatedExpression.cs index 35582ec1d..ff5b8838a 100644 --- a/ICSharpCode.Decompiler/CSharp/TranslatedExpression.cs +++ b/ICSharpCode.Decompiler/CSharp/TranslatedExpression.cs @@ -223,8 +223,14 @@ namespace ICSharpCode.Decompiler.CSharp } return this; } - if (targetType.Kind == TypeKind.Unknown || targetType.Kind == TypeKind.Void || targetType.Kind == TypeKind.None) { + if (targetType.Kind == TypeKind.Void || targetType.Kind == TypeKind.None) { return this; // don't attempt to insert cast to '?' or 'void' as these are not valid. + } else if (targetType.Kind == TypeKind.Unknown) { + // don't attempt cast to '?', or casts between an unknown type and a known type with same name + if (targetType.Name == "?" || targetType.ReflectionName == type.ReflectionName) { + return this; + } + // However we still want explicit casts to types that are merely unresolved } var convAnnotation = this.Expression.Annotation(); if (convAnnotation != null) { @@ -416,6 +422,13 @@ namespace ICSharpCode.Decompiler.CSharp if (rr.IsCompileTimeConstant && !rr.IsError) { return expressionBuilder.ConvertConstantValue(rr, allowImplicitConversion) .WithILInstruction(this.ILInstructions); + } else if (rr.IsError && targetType.IsReferenceType == true && type.IsReferenceType == true) { + // Conversion between two reference types, but no direct cast allowed? cast via object + // Just make sure we avoid infinite recursion even if the resolver falsely claims we can't cast directly: + if (!(targetType.IsKnownType(KnownTypeCode.Object) || type.IsKnownType(KnownTypeCode.Object))) { + return this.ConvertTo(compilation.FindType(KnownTypeCode.Object), expressionBuilder) + .ConvertTo(targetType, expressionBuilder, checkForOverflow, allowImplicitConversion); + } } if (targetType.Kind == TypeKind.Pointer && (0.Equals(ResolveResult.ConstantValue) || 0u.Equals(ResolveResult.ConstantValue))) { if (allowImplicitConversion) { diff --git a/ICSharpCode.Decompiler/CSharp/WholeProjectDecompiler.cs b/ICSharpCode.Decompiler/CSharp/WholeProjectDecompiler.cs index a757e2921..f8283cc3f 100644 --- a/ICSharpCode.Decompiler/CSharp/WholeProjectDecompiler.cs +++ b/ICSharpCode.Decompiler/CSharp/WholeProjectDecompiler.cs @@ -36,6 +36,7 @@ using static ICSharpCode.Decompiler.Metadata.DotNetCorePathFinderExtensions; using static ICSharpCode.Decompiler.Metadata.MetadataExtensions; using ICSharpCode.Decompiler.Metadata; using ICSharpCode.Decompiler.Solution; +using ICSharpCode.Decompiler.DebugInfo; namespace ICSharpCode.Decompiler.CSharp { @@ -73,6 +74,8 @@ namespace ICSharpCode.Decompiler.CSharp public IAssemblyResolver AssemblyResolver { get; set; } + public IDebugInfoProvider DebugInfoProvider { get; set; } + /// /// The MSBuild ProjectGuid to use for the new project. /// null to automatically generate a new GUID. @@ -322,6 +325,7 @@ namespace ICSharpCode.Decompiler.CSharp CSharpDecompiler CreateDecompiler(DecompilerTypeSystem ts) { var decompiler = new CSharpDecompiler(ts, settings); + decompiler.DebugInfoProvider = DebugInfoProvider; decompiler.AstTransforms.Add(new EscapeInvalidIdentifiers()); decompiler.AstTransforms.Add(new RemoveCLSCompliantAttribute()); return decompiler; diff --git a/ICSharpCode.Decompiler/DecompilerSettings.cs b/ICSharpCode.Decompiler/DecompilerSettings.cs index f62d22969..167961528 100644 --- a/ICSharpCode.Decompiler/DecompilerSettings.cs +++ b/ICSharpCode.Decompiler/DecompilerSettings.cs @@ -537,6 +537,26 @@ namespace ICSharpCode.Decompiler } } + bool alwaysShowEnumMemberValues = false; + + /// + /// Gets/Sets whether to always show enum member values. + /// true: enum Kind { A = 0, B = 1, C = 5 } + /// false: enum Kind { A, B, C = 5 } + /// default: false + /// + [Category("Other")] + [Description("DecompilerSettings.AlwaysShowEnumMemberValues")] + public bool AlwaysShowEnumMemberValues { + get { return alwaysShowEnumMemberValues; } + set { + if (alwaysShowEnumMemberValues != value) { + alwaysShowEnumMemberValues = value; + OnPropertyChanged(); + } + } + } + bool useDebugSymbols = true; /// diff --git a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj index ff0318a04..45adfd61f 100644 --- a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj +++ b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.csproj @@ -33,7 +33,6 @@ portable true - true True $(DefineConstants);STEP @@ -41,7 +40,6 @@ portable true - true @@ -54,6 +52,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs b/ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs index fd4e3d4dd..ec20ef25c 100644 --- a/ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs +++ b/ICSharpCode.Decompiler/IL/ControlFlow/AsyncAwaitDecompiler.cs @@ -199,24 +199,26 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow return false; taskType = function.Method.ReturnType; builderType = startCall.Method.DeclaringTypeDefinition; - const string ns = "System.Runtime.CompilerServices"; if (taskType.IsKnownType(KnownTypeCode.Void)) { methodType = AsyncMethodType.Void; underlyingReturnType = taskType; - if (builderType?.FullTypeName != new TopLevelTypeName(ns, "AsyncVoidMethodBuilder")) + if (builderType?.FullTypeName != new TopLevelTypeName("System.Runtime.CompilerServices", "AsyncVoidMethodBuilder")) return false; - } else if (taskType.IsKnownType(KnownTypeCode.Task)) { + } else if (TaskType.IsNonGenericTaskType(taskType, out var builderTypeName)) { methodType = AsyncMethodType.Task; underlyingReturnType = context.TypeSystem.FindType(KnownTypeCode.Void); - if (builderType?.FullTypeName != new TopLevelTypeName(ns, "AsyncTaskMethodBuilder", 0)) + if (builderType?.FullTypeName != builderTypeName) return false; - } else if (taskType.IsKnownType(KnownTypeCode.TaskOfT)) { + } else if (TaskType.IsGenericTaskType(taskType, out builderTypeName)) { methodType = AsyncMethodType.TaskOfT; - underlyingReturnType = TaskType.UnpackTask(context.TypeSystem, taskType); - if (builderType?.FullTypeName != new TopLevelTypeName(ns, "AsyncTaskMethodBuilder", 1)) + if (taskType.IsKnownType(KnownTypeCode.TaskOfT)) + underlyingReturnType = TaskType.UnpackTask(context.TypeSystem, taskType); + else + underlyingReturnType = startCall.Method.DeclaringType.TypeArguments[0]; + if (builderType?.FullTypeName != builderTypeName) return false; } else { - return false; // TODO: generalized async return type + return false; } if (startCall.Arguments.Count != 2) return false; diff --git a/ICSharpCode.Decompiler/IL/ILReader.cs b/ICSharpCode.Decompiler/IL/ILReader.cs index 730198abf..f840dce25 100644 --- a/ICSharpCode.Decompiler/IL/ILReader.cs +++ b/ICSharpCode.Decompiler/IL/ILReader.cs @@ -1199,7 +1199,7 @@ namespace ICSharpCode.Decompiler.IL case false: // field of value type: ldfld can handle temporaries if (PeekStackType() == StackType.O || PeekStackType() == StackType.Unknown) - return new AddressOf(Pop()); + return new AddressOf(Pop(), field.DeclaringType); else return PopPointer(); default: diff --git a/ICSharpCode.Decompiler/IL/Instructions.cs b/ICSharpCode.Decompiler/IL/Instructions.cs index 67d736150..0d01840b5 100644 --- a/ICSharpCode.Decompiler/IL/Instructions.cs +++ b/ICSharpCode.Decompiler/IL/Instructions.cs @@ -2529,9 +2529,10 @@ namespace ICSharpCode.Decompiler.IL /// Stores the value into an anonymous temporary variable, and returns the address of that variable. public sealed partial class AddressOf : ILInstruction { - public AddressOf(ILInstruction value) : base(OpCode.AddressOf) + public AddressOf(ILInstruction value, IType type) : base(OpCode.AddressOf) { this.Value = value; + this.type = type; } public static readonly SlotInfo ValueSlot = new SlotInfo("Value", canInlineInto: true); ILInstruction value; @@ -2581,6 +2582,12 @@ namespace ICSharpCode.Decompiler.IL return clone; } public override StackType ResultType { get { return StackType.Ref; } } + IType type; + /// Returns the type operand. + public IType Type { + get { return type; } + set { type = value; InvalidateFlags(); } + } protected override InstructionFlags ComputeFlags() { return value.Flags; @@ -2594,6 +2601,8 @@ namespace ICSharpCode.Decompiler.IL { WriteILRange(output, options); output.Write(OpCode); + output.Write(' '); + type.WriteTo(output); output.Write('('); this.value.WriteTo(output, options); output.Write(')'); @@ -2613,7 +2622,7 @@ namespace ICSharpCode.Decompiler.IL protected internal override bool PerformMatch(ILInstruction other, ref Patterns.Match match) { var o = other as AddressOf; - return o != null && this.value.PerformMatch(o.value, ref match); + return o != null && this.value.PerformMatch(o.value, ref match) && type.Equals(o.type); } } } @@ -7805,14 +7814,16 @@ namespace ICSharpCode.Decompiler.IL value = default(ILInstruction); return false; } - public bool MatchAddressOf(out ILInstruction value) + public bool MatchAddressOf(out ILInstruction value, out IType type) { var inst = this as AddressOf; if (inst != null) { value = inst.Value; + type = inst.Type; return true; } value = default(ILInstruction); + type = default(IType); return false; } public bool MatchThreeValuedBoolAnd(out ILInstruction left, out ILInstruction right) diff --git a/ICSharpCode.Decompiler/IL/Instructions.tt b/ICSharpCode.Decompiler/IL/Instructions.tt index 97add0105..db99589f3 100644 --- a/ICSharpCode.Decompiler/IL/Instructions.tt +++ b/ICSharpCode.Decompiler/IL/Instructions.tt @@ -179,7 +179,7 @@ CustomClassName("StLoc"), HasVariableOperand("Store", generateCheckInvariant: false), CustomArguments(("value", null)), ResultType("variable.StackType")), new OpCode("addressof", "Stores the value into an anonymous temporary variable, and returns the address of that variable.", - CustomClassName("AddressOf"), CustomArguments(("value", null)), ResultType("Ref")), + CustomClassName("AddressOf"), CustomArguments(("value", null)), ResultType("Ref"), HasTypeOperand), new OpCode("3vl.bool.and", "Three valued logic and. Inputs are of type bool? or I4, output is of type bool?. Unlike logic.and(), does not have short-circuiting behavior.", CustomClassName("ThreeValuedBoolAnd"), Binary, ResultType("O")), new OpCode("3vl.bool.or", "Three valued logic or. Inputs are of type bool? or I4, output is of type bool?. Unlike logic.or(), does not have short-circuiting behavior.", diff --git a/ICSharpCode.Decompiler/IL/Instructions/ILFunction.cs b/ICSharpCode.Decompiler/IL/Instructions/ILFunction.cs index 0086b3f2d..2f4791b6b 100644 --- a/ICSharpCode.Decompiler/IL/Instructions/ILFunction.cs +++ b/ICSharpCode.Decompiler/IL/Instructions/ILFunction.cs @@ -214,13 +214,11 @@ namespace ICSharpCode.Decompiler.IL Debug.Assert(Method != null); break; case ILFunctionKind.Delegate: - Debug.Assert(Parent != null && !(Parent is Block)); Debug.Assert(DelegateType != null); Debug.Assert(DeclarationScope == null); Debug.Assert(!(DelegateType?.FullName == "System.Linq.Expressions.Expression" && DelegateType.TypeParameterCount == 1)); break; case ILFunctionKind.ExpressionTree: - Debug.Assert(Parent != null && !(Parent is Block)); Debug.Assert(DelegateType != null); Debug.Assert(DeclarationScope == null); Debug.Assert(DelegateType?.FullName == "System.Linq.Expressions.Expression" && DelegateType.TypeParameterCount == 1); diff --git a/ICSharpCode.Decompiler/IL/Instructions/PatternMatching.cs b/ICSharpCode.Decompiler/IL/Instructions/PatternMatching.cs index dbd25242f..ecc8dab60 100644 --- a/ICSharpCode.Decompiler/IL/Instructions/PatternMatching.cs +++ b/ICSharpCode.Decompiler/IL/Instructions/PatternMatching.cs @@ -418,7 +418,7 @@ namespace ICSharpCode.Decompiler.IL { if (this is LdObj ldobj && ldobj.Target is LdFlda ldflda && ldobj.UnalignedPrefix == 0 && !ldobj.IsVolatile) { field = ldflda.Field; - if (field.DeclaringType.IsReferenceType == true || !ldflda.Target.MatchAddressOf(out target)) { + if (field.DeclaringType.IsReferenceType == true || !ldflda.Target.MatchAddressOf(out target, out _)) { target = ldflda.Target; } return true; diff --git a/ICSharpCode.Decompiler/IL/Transforms/AssignVariableNames.cs b/ICSharpCode.Decompiler/IL/Transforms/AssignVariableNames.cs index 71d4a545c..80007b1c7 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/AssignVariableNames.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/AssignVariableNames.cs @@ -493,7 +493,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms AddExistingName(reservedVariableNames, v.Name); } } - foreach (var f in rootFunction.Method.DeclaringTypeDefinition.Fields.Select(f => f.Name)) + foreach (var f in rootFunction.Method.DeclaringTypeDefinition.GetFields().Select(f => f.Name)) AddExistingName(reservedVariableNames, f); return reservedVariableNames; } diff --git a/ICSharpCode.Decompiler/IL/Transforms/EarlyExpressionTransforms.cs b/ICSharpCode.Decompiler/IL/Transforms/EarlyExpressionTransforms.cs index 5ee5b2fbe..8b5b3c6e7 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/EarlyExpressionTransforms.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/EarlyExpressionTransforms.cs @@ -95,7 +95,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms temp = ldfldaTarget; range = range.Concat(temp.ILRanges); } - if (temp.MatchAddressOf(out var addressOfTarget) && addressOfTarget.MatchLdLoc(out var v)) { + if (temp.MatchAddressOf(out var addressOfTarget, out _) && addressOfTarget.MatchLdLoc(out var v)) { context.Step($"ldobj(...(addressof(ldloca {v.Name}))) => ldobj(...(ldloca {v.Name}))", inst); var replacement = new LdLoca(v).WithILRange(addressOfTarget); foreach (var r in range) { diff --git a/ICSharpCode.Decompiler/IL/Transforms/ILInlining.cs b/ICSharpCode.Decompiler/IL/Transforms/ILInlining.cs index d1d8a0e69..3f3a658d7 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/ILInlining.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/ILInlining.cs @@ -226,7 +226,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms if (loadInst.OpCode == OpCode.LdLoca) { // it was an ldloca instruction, so we need to use the pseudo-opcode 'addressof' // to preserve the semantics of the compiler-generated temporary - loadInst.ReplaceWith(new AddressOf(inlinedExpression)); + Debug.Assert(((LdLoca)loadInst).Variable == v); + loadInst.ReplaceWith(new AddressOf(inlinedExpression, v.Type)); } else { loadInst.ReplaceWith(inlinedExpression); } diff --git a/ICSharpCode.Decompiler/IL/Transforms/LocalFunctionDecompiler.cs b/ICSharpCode.Decompiler/IL/Transforms/LocalFunctionDecompiler.cs index 8c52794f0..5adbdf4e0 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/LocalFunctionDecompiler.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/LocalFunctionDecompiler.cs @@ -44,6 +44,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms struct LocalFunctionInfo { public List UseSites; + public IMethod Method; public ILFunction Definition; } @@ -70,8 +71,13 @@ namespace ICSharpCode.Decompiler.IL.Transforms var cancellationToken = context.CancellationToken; // Find all local functions declared inside this method, including nested local functions or local functions declared in lambdas. FindUseSites(function, context, localFunctions); - foreach (var (method, info) in localFunctions) { + foreach (var (_, info) in localFunctions) { cancellationToken.ThrowIfCancellationRequested(); + if (info.Definition == null) { + function.Warnings.Add($"Could not decode local function '{info.Method}'"); + continue; + } + var firstUseSite = info.UseSites[0]; context.StepStartGroup($"Transform " + info.Definition.Name, info.Definition); try { @@ -126,10 +132,13 @@ namespace ICSharpCode.Decompiler.IL.Transforms context.StepStartGroup($"Read local function '{targetMethod.Name}'", inst); info = new LocalFunctionInfo() { UseSites = new List() { inst }, + Method = targetMethod, Definition = ReadLocalFunctionDefinition(context.Function, targetMethod) }; localFunctions.Add((MethodDefinitionHandle)targetMethod.MetadataToken, info); - FindUseSites(info.Definition, context, localFunctions); + if (info.Definition != null) { + FindUseSites(info.Definition, context, localFunctions); + } context.StepEndGroup(); } else { info.UseSites.Add(inst); diff --git a/ICSharpCode.Decompiler/IL/Transforms/NullPropagationTransform.cs b/ICSharpCode.Decompiler/IL/Transforms/NullPropagationTransform.cs index 9288c447b..90d41d06d 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/NullPropagationTransform.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/NullPropagationTransform.cs @@ -203,7 +203,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms return false; // setter/adder/remover cannot be called with ?. syntax } inst = call.Arguments[0]; - if ((call.ConstrainedTo ?? call.Method.DeclaringType).IsReferenceType == false && inst.MatchAddressOf(out var arg)) { + if ((call.ConstrainedTo ?? call.Method.DeclaringType).IsReferenceType == false && inst.MatchAddressOf(out var arg, out _)) { inst = arg; } // ensure the access chain does not contain any 'nullable.unwrap' that aren't directly part of the chain diff --git a/ICSharpCode.Decompiler/IL/Transforms/ProxyCallReplacer.cs b/ICSharpCode.Decompiler/IL/Transforms/ProxyCallReplacer.cs index d9279f1bb..13c87c56b 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/ProxyCallReplacer.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/ProxyCallReplacer.cs @@ -30,13 +30,12 @@ namespace ICSharpCode.Decompiler.IL.Transforms MethodDefinition methodDef = metadata.GetMethodDefinition((MethodDefinitionHandle)inst.Method.MetadataToken); if (!methodDef.HasBody()) return; - var genericContext = DelegateConstruction.GenericContextFromTypeArguments(inst.Method.Substitution); - if (genericContext == null) - return; + // Use the callee's generic context + var genericContext = new GenericContext(inst.Method); // partially copied from CSharpDecompiler var ilReader = context.CreateILReader(); var body = context.PEFile.Reader.GetMethodBody(methodDef.RelativeVirtualAddress); - var proxyFunction = ilReader.ReadIL(handle, body, genericContext.Value, ILFunctionKind.TopLevelFunction, context.CancellationToken); + var proxyFunction = ilReader.ReadIL(handle, body, genericContext, ILFunctionKind.TopLevelFunction, context.CancellationToken); var transformContext = new ILTransformContext(context, proxyFunction); proxyFunction.RunTransforms(CSharp.CSharpDecompiler.EarlyILTransforms(), transformContext); if (!(proxyFunction.Body is BlockContainer blockContainer)) @@ -81,8 +80,14 @@ namespace ICSharpCode.Decompiler.IL.Transforms } } context.Step("Replace proxy: " + inst.Method.Name + " with " + call.Method.Name, inst); - Call newInst = (Call)call.Clone(); - + // Apply the wrapper call's substitution to the actual method call. + Call newInst = new Call(call.Method.Specialize(inst.Method.Substitution)); + // copy flags + newInst.ConstrainedTo = call.ConstrainedTo; + newInst.ILStackWasEmpty = inst.ILStackWasEmpty; + newInst.IsTail = call.IsTail & inst.IsTail; + // copy IL ranges + newInst.AddILRange(inst); newInst.Arguments.ReplaceList(inst.Arguments); inst.ReplaceWith(newInst); } diff --git a/ICSharpCode.Decompiler/IL/Transforms/SwitchOnStringTransform.cs b/ICSharpCode.Decompiler/IL/Transforms/SwitchOnStringTransform.cs index 7c8575c20..c9c1cd804 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/SwitchOnStringTransform.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/SwitchOnStringTransform.cs @@ -203,6 +203,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms switchValue = new LdLoc(switchValueVar); } } else { + // Instruction before the start of the switch is not related to the switch. + keepAssignmentBefore = true; switchValue = new LdLoc(switchValueVar); } // if instruction must be followed by a branch to the next case diff --git a/ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs b/ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs index 07ba5adff..537c1fb03 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs @@ -541,7 +541,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms if (target.ResultType == StackType.Ref) return target; else - return new AddressOf(target); + return new AddressOf(target, expectedType); case StackType.O: if (targetType.IsReferenceType == false) { return new Box(target, targetType); @@ -721,7 +721,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms if (member.DeclaringType.IsReferenceType == true) { inst = new LdFlda(target, (IField)member); } else { - inst = new LdFlda(new AddressOf(target), (IField)member); + inst = new LdFlda(new AddressOf(target, member.DeclaringType), (IField)member); } } if (typeHint.SkipModifiers() is ByReferenceType brt && !member.ReturnType.IsByRefLike) { diff --git a/ICSharpCode.Decompiler/IL/Transforms/UsingTransform.cs b/ICSharpCode.Decompiler/IL/Transforms/UsingTransform.cs index 471319713..86e0cecf2 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/UsingTransform.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/UsingTransform.cs @@ -224,7 +224,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms return false; var firstArg = callVirt.Arguments.FirstOrDefault(); if (!(firstArg.MatchUnboxAny(out var innerArg1, out var unboxType) && unboxType.IsKnownType(KnownTypeCode.IDisposable))) { - if (!firstArg.MatchAddressOf(out var innerArg2)) + if (!firstArg.MatchAddressOf(out var innerArg2, out _)) return false; return NullableLiftingTransform.MatchGetValueOrDefault(innerArg2, objVar) || (innerArg2 is NullableUnwrap unwrap diff --git a/ICSharpCode.Decompiler/Metadata/OperandType.cs b/ICSharpCode.Decompiler/Metadata/OperandType.cs index 8a8e7e0fc..900cf1218 100644 --- a/ICSharpCode.Decompiler/Metadata/OperandType.cs +++ b/ICSharpCode.Decompiler/Metadata/OperandType.cs @@ -94,7 +94,9 @@ namespace ICSharpCode.Decompiler.Metadata "vararg", "variant", "vector", "virtual", "void", "wchar", "winapi", "with", "wrapper", // These are not listed as keywords in spec, but ILAsm treats them as such - "property", "type", "flags", "callconv", "strict" + "property", "type", "flags", "callconv", "strict", + // ILDasm uses these keywords for unsigned integers + "uint8", "uint16", "uint32", "uint64" ); } diff --git a/ICSharpCode.Decompiler/Metadata/UniversalAssemblyResolver.cs b/ICSharpCode.Decompiler/Metadata/UniversalAssemblyResolver.cs index 51a1c8cfe..d7b5ae5aa 100644 --- a/ICSharpCode.Decompiler/Metadata/UniversalAssemblyResolver.cs +++ b/ICSharpCode.Decompiler/Metadata/UniversalAssemblyResolver.cs @@ -26,7 +26,7 @@ using System.Text; namespace ICSharpCode.Decompiler.Metadata { - // This inspired by Mono.Cecil's BaseAssemblyResolver/DefaultAssemblyResolver. + // This is inspired by Mono.Cecil's BaseAssemblyResolver/DefaultAssemblyResolver. public class UniversalAssemblyResolver : IAssemblyResolver { static UniversalAssemblyResolver() diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/DefaultTypeParameter.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/DefaultTypeParameter.cs index 8ff30441a..4333be38d 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/DefaultTypeParameter.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/DefaultTypeParameter.cs @@ -28,7 +28,6 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation readonly bool hasReferenceTypeConstraint; readonly bool hasDefaultConstructorConstraint; readonly Nullability nullabilityConstraint; - readonly IReadOnlyList constraints; readonly IReadOnlyList attributes; public DefaultTypeParameter( diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/KnownAttributes.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/KnownAttributes.cs index 209d198eb..766cdc025 100644 --- a/ICSharpCode.Decompiler/TypeSystem/Implementation/KnownAttributes.cs +++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/KnownAttributes.cs @@ -63,6 +63,7 @@ namespace ICSharpCode.Decompiler.TypeSystem IsByRefLike, IteratorStateMachine, AsyncStateMachine, + AsyncMethodBuilder, // Field attributes: FieldOffset, @@ -129,6 +130,7 @@ namespace ICSharpCode.Decompiler.TypeSystem new TopLevelTypeName("System.Runtime.CompilerServices", "IsByRefLikeAttribute"), new TopLevelTypeName("System.Runtime.CompilerServices", nameof(IteratorStateMachineAttribute)), new TopLevelTypeName("System.Runtime.CompilerServices", nameof(AsyncStateMachineAttribute)), + new TopLevelTypeName("System.Runtime.CompilerServices", "AsyncMethodBuilderAttribute"), // Field attributes: new TopLevelTypeName("System.Runtime.InteropServices", nameof(FieldOffsetAttribute)), new TopLevelTypeName("System", nameof(NonSerializedAttribute)), diff --git a/ICSharpCode.Decompiler/TypeSystem/TaskType.cs b/ICSharpCode.Decompiler/TypeSystem/TaskType.cs index 5aca29c9d..63aa880d0 100644 --- a/ICSharpCode.Decompiler/TypeSystem/TaskType.cs +++ b/ICSharpCode.Decompiler/TypeSystem/TaskType.cs @@ -54,7 +54,67 @@ namespace ICSharpCode.Decompiler.TypeSystem } return false; } - + + /// + /// Gets whether the specified type is a Task-like type. + /// + public static bool IsCustomTask(IType type, out IType builderType) + { + builderType = null; + ITypeDefinition def = type.GetDefinition(); + if (def != null) { + if (def.TypeParameterCount > 1) + return false; + var attribute = def.GetAttribute(KnownAttribute.AsyncMethodBuilder); + if (attribute == null || attribute.FixedArguments.Length != 1) + return false; + var arg = attribute.FixedArguments[0]; + if (!arg.Type.IsKnownType(KnownTypeCode.Type)) + return false; + builderType = (IType)arg.Value; + return true; + } + return false; + } + + const string ns = "System.Runtime.CompilerServices"; + + /// + /// Gets whether the specified type is a non-generic Task-like type. + /// + /// Returns the full type-name of the builder type, if successful. + public static bool IsNonGenericTaskType(IType task, out FullTypeName builderTypeName) + { + if (task.IsKnownType(KnownTypeCode.Task)) { + builderTypeName = new TopLevelTypeName(ns, "AsyncTaskMethodBuilder"); + return true; + } + if (IsCustomTask(task, out var builderType)) { + builderTypeName = new FullTypeName(builderType.ReflectionName); + return builderTypeName.TypeParameterCount == 0; + } + builderTypeName = default; + return false; + } + + /// + /// Gets whether the specified type is a generic Task-like type. + /// + /// Returns the full type-name of the builder type, if successful. + public static bool IsGenericTaskType(IType task, out FullTypeName builderTypeName) + { + if (task.IsKnownType(KnownTypeCode.TaskOfT)) { + builderTypeName = new TopLevelTypeName(ns, "AsyncTaskMethodBuilder", 1); + return true; + } + if (IsCustomTask(task, out var builderType)) { + builderTypeName = new FullTypeName(builderType.ReflectionName); + return builderTypeName.TypeParameterCount == 1; + } + builderTypeName = default; + return false; + } + /// /// Creates a task type. /// diff --git a/ILSpy.AddIn/Commands/OpenReferenceCommand.cs b/ILSpy.AddIn/Commands/OpenReferenceCommand.cs index 5c2b61fa8..dd6ab3581 100644 --- a/ILSpy.AddIn/Commands/OpenReferenceCommand.cs +++ b/ILSpy.AddIn/Commands/OpenReferenceCommand.cs @@ -59,12 +59,14 @@ namespace ICSharpCode.ILSpy.AddIn.Commands OpenAssembliesInILSpy(parameters); else owner.ShowMessage("Could not find reference '{0}', please ensure the project and all references were built correctly!", reference.Name); + return; } // Handle NuGet references var nugetRefItem = NuGetReferenceForILSpy.Detect(itemObject); if (nugetRefItem != null) { OpenAssembliesInILSpy(nugetRefItem.GetILSpyParameters()); + return; } // Handle project references diff --git a/ILSpy.AddIn/ILSpy.AddIn.csproj b/ILSpy.AddIn/ILSpy.AddIn.csproj index 1126fcf82..c0d961a09 100644 --- a/ILSpy.AddIn/ILSpy.AddIn.csproj +++ b/ILSpy.AddIn/ILSpy.AddIn.csproj @@ -7,7 +7,7 @@ - net462 + net472 ICSharpCode.ILSpy.AddIn IC#Code @@ -114,7 +114,6 @@ - @@ -130,8 +129,7 @@ - - + diff --git a/ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj b/ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj index 1958ed447..16cab36f6 100644 --- a/ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj +++ b/ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj @@ -2,7 +2,7 @@ - net462 + net472 False diff --git a/ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj b/ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj index 92f6ef0ff..ee81f61fd 100644 --- a/ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj +++ b/ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj @@ -3,7 +3,7 @@ - net462 + net472 ILSpy.BamlDecompiler.Plugin 7.2 @@ -37,7 +37,7 @@ - + diff --git a/ILSpy.Package/ILSpy.Package.wapproj b/ILSpy.Package/ILSpy.Package.wapproj index cdfcbec41..b4a01b820 100644 --- a/ILSpy.Package/ILSpy.Package.wapproj +++ b/ILSpy.Package/ILSpy.Package.wapproj @@ -20,22 +20,6 @@ Release x64 - - Debug - ARM - - - Release - ARM - - - Debug - ARM64 - - - Release - ARM64 - Debug AnyCPU diff --git a/ILSpy.Package/Images/StoreLogo.backup.png b/ILSpy.Package/Images/StoreLogo.backup.png index 7385b56c0..2e51ccc66 100644 Binary files a/ILSpy.Package/Images/StoreLogo.backup.png and b/ILSpy.Package/Images/StoreLogo.backup.png differ diff --git a/ILSpy.Package/Package-CI.appxmanifest b/ILSpy.Package/Package-CI.appxmanifest index 27b6e8f9f..2f1f75eae 100644 --- a/ILSpy.Package/Package-CI.appxmanifest +++ b/ILSpy.Package/Package-CI.appxmanifest @@ -15,7 +15,7 @@ ILSpy (CI) - ICSharpCode + CN=ICSharpCode Team Images\StoreLogo.png diff --git a/ILSpy.Package/Package-Local.appxmanifest b/ILSpy.Package/Package-Local.appxmanifest index da934f3a9..1922193ed 100644 --- a/ILSpy.Package/Package-Local.appxmanifest +++ b/ILSpy.Package/Package-Local.appxmanifest @@ -15,7 +15,7 @@ ILSpy (Local) - ICSharpCode + CN=ICSharpCode Team Images\StoreLogo.png diff --git a/ILSpy.Package/Package.appxmanifest b/ILSpy.Package/Package.appxmanifest index cd8740c55..4375f716b 100644 --- a/ILSpy.Package/Package.appxmanifest +++ b/ILSpy.Package/Package.appxmanifest @@ -9,13 +9,13 @@ IgnorableNamespaces="uap rescap"> ILSpy - ICSharpCode + ICSharpCode Team Images\StoreLogo.png diff --git a/ILSpy.Tests/ILSpy.Tests.csproj b/ILSpy.Tests/ILSpy.Tests.csproj index aaa41c814..e2543cffc 100644 --- a/ILSpy.Tests/ILSpy.Tests.csproj +++ b/ILSpy.Tests/ILSpy.Tests.csproj @@ -2,7 +2,7 @@ - net462 + net472 7.3 True diff --git a/ILSpy.WithPackage.sln b/ILSpy.WithPackage.sln index 91d19a76e..e362c907c 100644 --- a/ILSpy.WithPackage.sln +++ b/ILSpy.WithPackage.sln @@ -44,213 +44,129 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|ARM = Debug|ARM - Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU - Release|ARM = Release|ARM - Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Debug|ARM.ActiveCfg = Debug|Any CPU - {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Debug|ARM.Build.0 = Debug|Any CPU - {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Debug|ARM64.Build.0 = Debug|Any CPU {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Debug|x64.ActiveCfg = Debug|Any CPU {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Debug|x64.Build.0 = Debug|Any CPU {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Debug|x86.ActiveCfg = Debug|Any CPU {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Debug|x86.Build.0 = Debug|Any CPU {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Release|Any CPU.ActiveCfg = Release|Any CPU {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Release|Any CPU.Build.0 = Release|Any CPU - {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Release|ARM.ActiveCfg = Release|Any CPU - {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Release|ARM.Build.0 = Release|Any CPU - {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Release|ARM64.ActiveCfg = Release|Any CPU - {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Release|ARM64.Build.0 = Release|Any CPU {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Release|x64.ActiveCfg = Release|Any CPU {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Release|x64.Build.0 = Release|Any CPU {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Release|x86.ActiveCfg = Release|Any CPU {1E85EFF9-E370-4683-83E4-8A3D063FF791}.Release|x86.Build.0 = Release|Any CPU {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|ARM.ActiveCfg = Debug|Any CPU - {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|ARM.Build.0 = Debug|Any CPU - {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|ARM64.Build.0 = Debug|Any CPU {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|x64.ActiveCfg = Debug|Any CPU {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|x64.Build.0 = Debug|Any CPU {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|x86.ActiveCfg = Debug|Any CPU {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Debug|x86.Build.0 = Debug|Any CPU {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|Any CPU.ActiveCfg = Release|Any CPU {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|Any CPU.Build.0 = Release|Any CPU - {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|ARM.ActiveCfg = Release|Any CPU - {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|ARM.Build.0 = Release|Any CPU - {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|ARM64.ActiveCfg = Release|Any CPU - {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|ARM64.Build.0 = Release|Any CPU {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|x64.ActiveCfg = Release|Any CPU {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|x64.Build.0 = Release|Any CPU {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|x86.ActiveCfg = Release|Any CPU {DDE2A481-8271-4EAC-A330-8FA6A38D13D1}.Release|x86.Build.0 = Release|Any CPU {984CC812-9470-4A13-AFF9-CC44068D666C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {984CC812-9470-4A13-AFF9-CC44068D666C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {984CC812-9470-4A13-AFF9-CC44068D666C}.Debug|ARM.ActiveCfg = Debug|Any CPU - {984CC812-9470-4A13-AFF9-CC44068D666C}.Debug|ARM.Build.0 = Debug|Any CPU - {984CC812-9470-4A13-AFF9-CC44068D666C}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {984CC812-9470-4A13-AFF9-CC44068D666C}.Debug|ARM64.Build.0 = Debug|Any CPU {984CC812-9470-4A13-AFF9-CC44068D666C}.Debug|x64.ActiveCfg = Debug|Any CPU {984CC812-9470-4A13-AFF9-CC44068D666C}.Debug|x64.Build.0 = Debug|Any CPU {984CC812-9470-4A13-AFF9-CC44068D666C}.Debug|x86.ActiveCfg = Debug|Any CPU {984CC812-9470-4A13-AFF9-CC44068D666C}.Debug|x86.Build.0 = Debug|Any CPU {984CC812-9470-4A13-AFF9-CC44068D666C}.Release|Any CPU.ActiveCfg = Release|Any CPU {984CC812-9470-4A13-AFF9-CC44068D666C}.Release|Any CPU.Build.0 = Release|Any CPU - {984CC812-9470-4A13-AFF9-CC44068D666C}.Release|ARM.ActiveCfg = Release|Any CPU - {984CC812-9470-4A13-AFF9-CC44068D666C}.Release|ARM.Build.0 = Release|Any CPU - {984CC812-9470-4A13-AFF9-CC44068D666C}.Release|ARM64.ActiveCfg = Release|Any CPU - {984CC812-9470-4A13-AFF9-CC44068D666C}.Release|ARM64.Build.0 = Release|Any CPU {984CC812-9470-4A13-AFF9-CC44068D666C}.Release|x64.ActiveCfg = Release|Any CPU {984CC812-9470-4A13-AFF9-CC44068D666C}.Release|x64.Build.0 = Release|Any CPU {984CC812-9470-4A13-AFF9-CC44068D666C}.Release|x86.ActiveCfg = Release|Any CPU {984CC812-9470-4A13-AFF9-CC44068D666C}.Release|x86.Build.0 = Release|Any CPU {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Debug|ARM.ActiveCfg = Debug|Any CPU - {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Debug|ARM.Build.0 = Debug|Any CPU - {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Debug|ARM64.Build.0 = Debug|Any CPU {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Debug|x64.ActiveCfg = Debug|Any CPU {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Debug|x64.Build.0 = Debug|Any CPU {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Debug|x86.ActiveCfg = Debug|Any CPU {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Debug|x86.Build.0 = Debug|Any CPU {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Release|Any CPU.ActiveCfg = Release|Any CPU {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Release|Any CPU.Build.0 = Release|Any CPU - {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Release|ARM.ActiveCfg = Release|Any CPU - {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Release|ARM.Build.0 = Release|Any CPU - {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Release|ARM64.ActiveCfg = Release|Any CPU - {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Release|ARM64.Build.0 = Release|Any CPU {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Release|x64.ActiveCfg = Release|Any CPU {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Release|x64.Build.0 = Release|Any CPU {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Release|x86.ActiveCfg = Release|Any CPU {FEC0DA52-C4A6-4710-BE36-B484A20C5E22}.Release|x86.Build.0 = Release|Any CPU {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Debug|ARM.ActiveCfg = Debug|Any CPU - {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Debug|ARM.Build.0 = Debug|Any CPU - {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Debug|ARM64.Build.0 = Debug|Any CPU {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Debug|x64.ActiveCfg = Debug|Any CPU {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Debug|x64.Build.0 = Debug|Any CPU {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Debug|x86.ActiveCfg = Debug|Any CPU {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Debug|x86.Build.0 = Debug|Any CPU {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Release|Any CPU.ActiveCfg = Release|Any CPU {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Release|Any CPU.Build.0 = Release|Any CPU - {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Release|ARM.ActiveCfg = Release|Any CPU - {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Release|ARM.Build.0 = Release|Any CPU - {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Release|ARM64.ActiveCfg = Release|Any CPU - {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Release|ARM64.Build.0 = Release|Any CPU {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Release|x64.ActiveCfg = Release|Any CPU {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Release|x64.Build.0 = Release|Any CPU {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Release|x86.ActiveCfg = Release|Any CPU {F32EBCC8-0E53-4421-867E-05B3D6E10C70}.Release|x86.Build.0 = Release|Any CPU {A6BAD2BA-76BA-461C-8B6D-418607591247}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A6BAD2BA-76BA-461C-8B6D-418607591247}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A6BAD2BA-76BA-461C-8B6D-418607591247}.Debug|ARM.ActiveCfg = Debug|Any CPU - {A6BAD2BA-76BA-461C-8B6D-418607591247}.Debug|ARM.Build.0 = Debug|Any CPU - {A6BAD2BA-76BA-461C-8B6D-418607591247}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {A6BAD2BA-76BA-461C-8B6D-418607591247}.Debug|ARM64.Build.0 = Debug|Any CPU {A6BAD2BA-76BA-461C-8B6D-418607591247}.Debug|x64.ActiveCfg = Debug|Any CPU {A6BAD2BA-76BA-461C-8B6D-418607591247}.Debug|x64.Build.0 = Debug|Any CPU {A6BAD2BA-76BA-461C-8B6D-418607591247}.Debug|x86.ActiveCfg = Debug|Any CPU {A6BAD2BA-76BA-461C-8B6D-418607591247}.Debug|x86.Build.0 = Debug|Any CPU {A6BAD2BA-76BA-461C-8B6D-418607591247}.Release|Any CPU.ActiveCfg = Release|Any CPU {A6BAD2BA-76BA-461C-8B6D-418607591247}.Release|Any CPU.Build.0 = Release|Any CPU - {A6BAD2BA-76BA-461C-8B6D-418607591247}.Release|ARM.ActiveCfg = Release|Any CPU - {A6BAD2BA-76BA-461C-8B6D-418607591247}.Release|ARM.Build.0 = Release|Any CPU - {A6BAD2BA-76BA-461C-8B6D-418607591247}.Release|ARM64.ActiveCfg = Release|Any CPU - {A6BAD2BA-76BA-461C-8B6D-418607591247}.Release|ARM64.Build.0 = Release|Any CPU {A6BAD2BA-76BA-461C-8B6D-418607591247}.Release|x64.ActiveCfg = Release|Any CPU {A6BAD2BA-76BA-461C-8B6D-418607591247}.Release|x64.Build.0 = Release|Any CPU {A6BAD2BA-76BA-461C-8B6D-418607591247}.Release|x86.ActiveCfg = Release|Any CPU {A6BAD2BA-76BA-461C-8B6D-418607591247}.Release|x86.Build.0 = Release|Any CPU {1169E6D1-1899-43D4-A500-07CE4235B388}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1169E6D1-1899-43D4-A500-07CE4235B388}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1169E6D1-1899-43D4-A500-07CE4235B388}.Debug|ARM.ActiveCfg = Debug|Any CPU - {1169E6D1-1899-43D4-A500-07CE4235B388}.Debug|ARM.Build.0 = Debug|Any CPU - {1169E6D1-1899-43D4-A500-07CE4235B388}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {1169E6D1-1899-43D4-A500-07CE4235B388}.Debug|ARM64.Build.0 = Debug|Any CPU {1169E6D1-1899-43D4-A500-07CE4235B388}.Debug|x64.ActiveCfg = Debug|Any CPU {1169E6D1-1899-43D4-A500-07CE4235B388}.Debug|x64.Build.0 = Debug|Any CPU {1169E6D1-1899-43D4-A500-07CE4235B388}.Debug|x86.ActiveCfg = Debug|Any CPU {1169E6D1-1899-43D4-A500-07CE4235B388}.Debug|x86.Build.0 = Debug|Any CPU {1169E6D1-1899-43D4-A500-07CE4235B388}.Release|Any CPU.ActiveCfg = Release|Any CPU {1169E6D1-1899-43D4-A500-07CE4235B388}.Release|Any CPU.Build.0 = Release|Any CPU - {1169E6D1-1899-43D4-A500-07CE4235B388}.Release|ARM.ActiveCfg = Release|Any CPU - {1169E6D1-1899-43D4-A500-07CE4235B388}.Release|ARM.Build.0 = Release|Any CPU - {1169E6D1-1899-43D4-A500-07CE4235B388}.Release|ARM64.ActiveCfg = Release|Any CPU - {1169E6D1-1899-43D4-A500-07CE4235B388}.Release|ARM64.Build.0 = Release|Any CPU {1169E6D1-1899-43D4-A500-07CE4235B388}.Release|x64.ActiveCfg = Release|Any CPU {1169E6D1-1899-43D4-A500-07CE4235B388}.Release|x64.Build.0 = Release|Any CPU {1169E6D1-1899-43D4-A500-07CE4235B388}.Release|x86.ActiveCfg = Release|Any CPU {1169E6D1-1899-43D4-A500-07CE4235B388}.Release|x86.Build.0 = Release|Any CPU {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Debug|ARM.ActiveCfg = Debug|Any CPU - {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Debug|ARM.Build.0 = Debug|Any CPU - {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Debug|ARM64.Build.0 = Debug|Any CPU {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Debug|x64.ActiveCfg = Debug|Any CPU {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Debug|x64.Build.0 = Debug|Any CPU {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Debug|x86.ActiveCfg = Debug|Any CPU {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Debug|x86.Build.0 = Debug|Any CPU {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Release|Any CPU.ActiveCfg = Release|Any CPU {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Release|Any CPU.Build.0 = Release|Any CPU - {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Release|ARM.ActiveCfg = Release|Any CPU - {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Release|ARM.Build.0 = Release|Any CPU - {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Release|ARM64.ActiveCfg = Release|Any CPU - {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Release|ARM64.Build.0 = Release|Any CPU {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Release|x64.ActiveCfg = Release|Any CPU {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Release|x64.Build.0 = Release|Any CPU {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Release|x86.ActiveCfg = Release|Any CPU {9D7BE6C0-B7B3-4A50-A54E-18A2D84A3384}.Release|x86.Build.0 = Release|Any CPU {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Debug|ARM.ActiveCfg = Debug|Any CPU - {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Debug|ARM.Build.0 = Debug|Any CPU - {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Debug|ARM64.Build.0 = Debug|Any CPU {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Debug|x64.ActiveCfg = Debug|Any CPU {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Debug|x64.Build.0 = Debug|Any CPU {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Debug|x86.ActiveCfg = Debug|Any CPU {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Debug|x86.Build.0 = Debug|Any CPU {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Release|Any CPU.ActiveCfg = Release|Any CPU {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Release|Any CPU.Build.0 = Release|Any CPU - {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Release|ARM.ActiveCfg = Release|Any CPU - {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Release|ARM.Build.0 = Release|Any CPU - {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Release|ARM64.ActiveCfg = Release|Any CPU - {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Release|ARM64.Build.0 = Release|Any CPU {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Release|x64.ActiveCfg = Release|Any CPU {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Release|x64.Build.0 = Release|Any CPU {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Release|x86.ActiveCfg = Release|Any CPU {B85A155A-9DD6-43BC-A624-2D8EC773D71F}.Release|x86.Build.0 = Release|Any CPU {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Debug|ARM.ActiveCfg = Debug|Any CPU - {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Debug|ARM.Build.0 = Debug|Any CPU - {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Debug|ARM64.Build.0 = Debug|Any CPU {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Debug|x64.ActiveCfg = Debug|Any CPU {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Debug|x64.Build.0 = Debug|Any CPU {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Debug|x86.ActiveCfg = Debug|Any CPU {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Debug|x86.Build.0 = Debug|Any CPU {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Release|Any CPU.ActiveCfg = Release|Any CPU {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Release|Any CPU.Build.0 = Release|Any CPU - {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Release|ARM.ActiveCfg = Release|Any CPU - {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Release|ARM.Build.0 = Release|Any CPU - {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Release|ARM64.ActiveCfg = Release|Any CPU - {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Release|ARM64.Build.0 = Release|Any CPU {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Release|x64.ActiveCfg = Release|Any CPU {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Release|x64.Build.0 = Release|Any CPU {B51C6636-B8D1-4200-9869-08F2689DE6C2}.Release|x86.ActiveCfg = Release|Any CPU @@ -258,12 +174,6 @@ Global {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Debug|Any CPU.Build.0 = Debug|Any CPU {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Debug|ARM.ActiveCfg = Debug|ARM - {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Debug|ARM.Build.0 = Debug|ARM - {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Debug|ARM.Deploy.0 = Debug|ARM - {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Debug|ARM64.Build.0 = Debug|ARM64 - {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Debug|ARM64.Deploy.0 = Debug|ARM64 {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Debug|x64.ActiveCfg = Debug|x64 {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Debug|x64.Build.0 = Debug|x64 {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Debug|x64.Deploy.0 = Debug|x64 @@ -273,12 +183,6 @@ Global {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Release|Any CPU.ActiveCfg = Release|Any CPU {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Release|Any CPU.Build.0 = Release|Any CPU {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Release|Any CPU.Deploy.0 = Release|Any CPU - {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Release|ARM.ActiveCfg = Release|ARM - {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Release|ARM.Build.0 = Release|ARM - {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Release|ARM.Deploy.0 = Release|ARM - {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Release|ARM64.ActiveCfg = Release|ARM64 - {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Release|ARM64.Build.0 = Release|ARM64 - {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Release|ARM64.Deploy.0 = Release|ARM64 {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Release|x64.ActiveCfg = Release|x64 {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Release|x64.Build.0 = Release|x64 {BAB51A23-9C15-42CC-8465-EB732BF9A932}.Release|x64.Deploy.0 = Release|x64 diff --git a/ILSpy/Analyzers/AnalyzeCommand.cs b/ILSpy/Analyzers/AnalyzeCommand.cs index 72117338b..3d8ae667c 100644 --- a/ILSpy/Analyzers/AnalyzeCommand.cs +++ b/ILSpy/Analyzers/AnalyzeCommand.cs @@ -25,7 +25,7 @@ using ICSharpCode.ILSpy.TreeNodes; namespace ICSharpCode.ILSpy.Analyzers { - [ExportContextMenuEntry(Header = nameof(Resources.Analyze), Icon = "images/Search.png", Category = nameof(Resources.Analyze), InputGestureText = "Ctrl+R", Order = 100)] + [ExportContextMenuEntry(Header = nameof(Resources.Analyze), Icon = "Images/Search", Category = nameof(Resources.Analyze), InputGestureText = "Ctrl+R", Order = 100)] internal sealed class AnalyzeCommand : SimpleCommand, IContextMenuEntry { public bool IsVisible(TextViewContext context) diff --git a/ILSpy/Analyzers/Builtin/EventImplementsInterfaceAnalyzer.cs b/ILSpy/Analyzers/Builtin/EventImplementsInterfaceAnalyzer.cs index c6efcd98f..8f25b069d 100644 --- a/ILSpy/Analyzers/Builtin/EventImplementsInterfaceAnalyzer.cs +++ b/ILSpy/Analyzers/Builtin/EventImplementsInterfaceAnalyzer.cs @@ -42,15 +42,16 @@ namespace ICSharpCode.ILSpy.Analyzers.Builtin IEnumerable AnalyzeType(IEvent analyzedEntity, ITypeDefinition type) { - var token = analyzedEntity.DeclaringTypeDefinition.MetadataToken; + var token = analyzedEntity.MetadataToken; + var declaringTypeToken = analyzedEntity.DeclaringTypeDefinition.MetadataToken; var module = analyzedEntity.DeclaringTypeDefinition.ParentModule.PEFile; - if (!type.GetAllBaseTypeDefinitions() - .Any(t => t.MetadataToken == token && t.ParentModule.PEFile == module)) + var allTypes = type.GetAllBaseTypeDefinitions(); + if (!allTypes.Any(t => t.MetadataToken == declaringTypeToken && t.ParentModule.PEFile == module)) yield break; - foreach (var @event in type.GetEvents(options: GetMemberOptions.ReturnMemberDefinitions)) { - if (InheritanceHelper.GetBaseMembers(@event, true) - .Any(m => m.DeclaringTypeDefinition.MetadataToken == token && m.ParentModule.PEFile == module)) + foreach (var @event in type.Events) { + var baseMembers = InheritanceHelper.GetBaseMembers(@event, true); + if (baseMembers.Any(m => m.MetadataToken == token && m.ParentModule.PEFile == module)) yield return @event; } } diff --git a/ILSpy/Analyzers/Builtin/EventOverriddenByAnalyzer.cs b/ILSpy/Analyzers/Builtin/EventOverriddenByAnalyzer.cs index 2688f72c3..29df80155 100644 --- a/ILSpy/Analyzers/Builtin/EventOverriddenByAnalyzer.cs +++ b/ILSpy/Analyzers/Builtin/EventOverriddenByAnalyzer.cs @@ -42,15 +42,17 @@ namespace ICSharpCode.ILSpy.Analyzers.Builtin IEnumerable AnalyzeType(IEvent analyzedEntity, ITypeDefinition type) { - if (!analyzedEntity.DeclaringType.GetAllBaseTypeDefinitions() - .Any(t => t.MetadataToken == analyzedEntity.DeclaringTypeDefinition.MetadataToken && t.ParentModule.PEFile == type.ParentModule.PEFile)) + var token = analyzedEntity.MetadataToken; + var declaringTypeToken = analyzedEntity.DeclaringTypeDefinition.MetadataToken; + var module = analyzedEntity.DeclaringTypeDefinition.ParentModule.PEFile; + var allTypes = type.GetAllBaseTypeDefinitions(); + if (!allTypes.Any(t => t.MetadataToken == declaringTypeToken && t.ParentModule.PEFile == module)) yield break; foreach (var @event in type.Events) { if (!@event.IsOverride) continue; - if (InheritanceHelper.GetBaseMembers(@event, false) - .Any(p => p.MetadataToken == analyzedEntity.MetadataToken && - p.ParentModule.PEFile == analyzedEntity.ParentModule.PEFile)) { + var baseMembers = InheritanceHelper.GetBaseMembers(@event, false); + if (baseMembers.Any(p => p.MetadataToken == token && p.ParentModule.PEFile == module)) { yield return @event; } } diff --git a/ILSpy/Analyzers/Builtin/MethodImplementsInterfaceAnalyzer.cs b/ILSpy/Analyzers/Builtin/MethodImplementsInterfaceAnalyzer.cs index 75c8c4e6a..099cd069e 100644 --- a/ILSpy/Analyzers/Builtin/MethodImplementsInterfaceAnalyzer.cs +++ b/ILSpy/Analyzers/Builtin/MethodImplementsInterfaceAnalyzer.cs @@ -45,15 +45,16 @@ namespace ICSharpCode.ILSpy.Analyzers.Builtin IEnumerable AnalyzeType(IMethod analyzedEntity, ITypeDefinition type) { - var token = analyzedEntity.DeclaringTypeDefinition.MetadataToken; + var token = analyzedEntity.MetadataToken; + var declaringTypeToken = analyzedEntity.DeclaringTypeDefinition.MetadataToken; var module = analyzedEntity.DeclaringTypeDefinition.ParentModule.PEFile; - if (!type.GetAllBaseTypeDefinitions() - .Any(t => t.MetadataToken == token && t.ParentModule.PEFile == module)) + var allTypes = type.GetAllBaseTypeDefinitions(); + if (!allTypes.Any(t => t.MetadataToken == declaringTypeToken && t.ParentModule.PEFile == module)) yield break; - foreach (var method in type.GetMethods(options: GetMemberOptions.ReturnMemberDefinitions)) { - if (InheritanceHelper.GetBaseMembers(method, true) - .Any(m => m.DeclaringTypeDefinition.MetadataToken == token && m.ParentModule.PEFile == module)) + foreach (var method in type.Methods) { + var baseMembers = InheritanceHelper.GetBaseMembers(method, true); + if (baseMembers.Any(m => m.MetadataToken == token && m.ParentModule.PEFile == module)) yield return method; } } diff --git a/ILSpy/Analyzers/Builtin/MethodOverriddenByAnalyzer.cs b/ILSpy/Analyzers/Builtin/MethodOverriddenByAnalyzer.cs index 4d65b8f91..830cc02ba 100644 --- a/ILSpy/Analyzers/Builtin/MethodOverriddenByAnalyzer.cs +++ b/ILSpy/Analyzers/Builtin/MethodOverriddenByAnalyzer.cs @@ -44,16 +44,17 @@ namespace ICSharpCode.ILSpy.Analyzers.Builtin IEnumerable AnalyzeType(IMethod analyzedEntity, ITypeDefinition type) { - if (!type.GetAllBaseTypeDefinitions() - .Any(t => t.MetadataToken == analyzedEntity.DeclaringTypeDefinition.MetadataToken - && t.ParentModule.PEFile == analyzedEntity.ParentModule.PEFile)) + var token = analyzedEntity.MetadataToken; + var declaringTypeToken = analyzedEntity.DeclaringTypeDefinition.MetadataToken; + var module = analyzedEntity.DeclaringTypeDefinition.ParentModule.PEFile; + var allTypes = type.GetAllBaseTypeDefinitions(); + if (!allTypes.Any(t => t.MetadataToken == declaringTypeToken && t.ParentModule.PEFile == module)) yield break; foreach (var method in type.Methods) { if (!method.IsOverride) continue; - if (InheritanceHelper.GetBaseMembers(method, false) - .Any(p => p.MetadataToken == analyzedEntity.MetadataToken && - p.ParentModule.PEFile == analyzedEntity.ParentModule.PEFile)) { + var baseMembers = InheritanceHelper.GetBaseMembers(method, false); + if (baseMembers.Any(p => p.MetadataToken == token && p.ParentModule.PEFile == module)) { yield return method; } } diff --git a/ILSpy/Analyzers/Builtin/PropertyImplementsInterfaceAnalyzer.cs b/ILSpy/Analyzers/Builtin/PropertyImplementsInterfaceAnalyzer.cs index 938e0e4e2..f23db8cc6 100644 --- a/ILSpy/Analyzers/Builtin/PropertyImplementsInterfaceAnalyzer.cs +++ b/ILSpy/Analyzers/Builtin/PropertyImplementsInterfaceAnalyzer.cs @@ -42,15 +42,16 @@ namespace ICSharpCode.ILSpy.Analyzers.Builtin IEnumerable AnalyzeType(IProperty analyzedEntity, ITypeDefinition type) { - var token = analyzedEntity.DeclaringTypeDefinition.MetadataToken; + var token = analyzedEntity.MetadataToken; + var declaringTypeToken = analyzedEntity.DeclaringTypeDefinition.MetadataToken; var module = analyzedEntity.DeclaringTypeDefinition.ParentModule.PEFile; - if (!type.GetAllBaseTypeDefinitions() - .Any(t => t.MetadataToken == token && t.ParentModule.PEFile == module)) + var allTypes = type.GetAllBaseTypeDefinitions(); + if (!allTypes.Any(t => t.MetadataToken == declaringTypeToken && t.ParentModule.PEFile == module)) yield break; - foreach (var property in type.GetProperties(options: GetMemberOptions.ReturnMemberDefinitions)) { - if (InheritanceHelper.GetBaseMembers(property, true) - .Any(m => m.DeclaringTypeDefinition.MetadataToken == token && m.ParentModule.PEFile == module)) + foreach (var property in type.Properties) { + var baseMembers = InheritanceHelper.GetBaseMembers(property, true); + if (baseMembers.Any(m => m.MetadataToken == token && m.ParentModule.PEFile == module)) yield return property; } } diff --git a/ILSpy/Analyzers/Builtin/PropertyOverriddenByAnalyzer.cs b/ILSpy/Analyzers/Builtin/PropertyOverriddenByAnalyzer.cs index b253a447d..7d310c078 100644 --- a/ILSpy/Analyzers/Builtin/PropertyOverriddenByAnalyzer.cs +++ b/ILSpy/Analyzers/Builtin/PropertyOverriddenByAnalyzer.cs @@ -45,15 +45,17 @@ namespace ICSharpCode.ILSpy.Analyzers.Builtin IEnumerable AnalyzeType(IProperty analyzedEntity, ITypeDefinition type) { - if (!analyzedEntity.DeclaringType.GetAllBaseTypeDefinitions() - .Any(t => t.MetadataToken == analyzedEntity.DeclaringTypeDefinition.MetadataToken && t.ParentModule.PEFile == type.ParentModule.PEFile)) + var token = analyzedEntity.MetadataToken; + var declaringTypeToken = analyzedEntity.DeclaringTypeDefinition.MetadataToken; + var module = analyzedEntity.DeclaringTypeDefinition.ParentModule.PEFile; + var allTypes = type.GetAllBaseTypeDefinitions(); + if (!allTypes.Any(t => t.MetadataToken == declaringTypeToken && t.ParentModule.PEFile == module)) yield break; foreach (var property in type.Properties) { if (!property.IsOverride) continue; - if (InheritanceHelper.GetBaseMembers(property, false) - .Any(p => p.MetadataToken == analyzedEntity.MetadataToken && - p.ParentModule.PEFile == analyzedEntity.ParentModule.PEFile)) { + var baseMembers = InheritanceHelper.GetBaseMembers(property, false); + if (baseMembers.Any(p => p.MetadataToken == token && p.ParentModule.PEFile == module)) { yield return property; } } diff --git a/ILSpy/Commands/BrowseBackCommand.cs b/ILSpy/Commands/BrowseBackCommand.cs index a79f11855..e3fe411b5 100644 --- a/ILSpy/Commands/BrowseBackCommand.cs +++ b/ILSpy/Commands/BrowseBackCommand.cs @@ -21,7 +21,7 @@ using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy { - [ExportToolbarCommand(ToolTip = nameof(Resources.Back), ToolbarIcon = "Images/Back.png", ToolbarCategory = nameof(Resources.Navigation), ToolbarOrder = 0)] + [ExportToolbarCommand(ToolTip = nameof(Resources.Back), ToolbarIcon = "Images/Back", ToolbarCategory = nameof(Resources.Navigation), ToolbarOrder = 0)] sealed class BrowseBackCommand : CommandWrapper { public BrowseBackCommand() diff --git a/ILSpy/Commands/BrowseForwardCommand.cs b/ILSpy/Commands/BrowseForwardCommand.cs index 583ddede1..e16b871fc 100644 --- a/ILSpy/Commands/BrowseForwardCommand.cs +++ b/ILSpy/Commands/BrowseForwardCommand.cs @@ -21,7 +21,7 @@ using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy { - [ExportToolbarCommand(ToolTip = nameof(Resources.Forward), ToolbarIcon = "Images/Forward.png", ToolbarCategory = nameof(Resources.Navigation), ToolbarOrder = 1)] + [ExportToolbarCommand(ToolTip = nameof(Resources.Forward), ToolbarIcon = "Images/Forward", ToolbarCategory = nameof(Resources.Navigation), ToolbarOrder = 1)] sealed class BrowseForwardCommand : CommandWrapper { public BrowseForwardCommand() diff --git a/ILSpy/Commands/OpenCommand.cs b/ILSpy/Commands/OpenCommand.cs index 0f5e86ca9..88a632610 100644 --- a/ILSpy/Commands/OpenCommand.cs +++ b/ILSpy/Commands/OpenCommand.cs @@ -21,8 +21,8 @@ using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy { - [ExportToolbarCommand(ToolTip = nameof(Resources.Open), ToolbarIcon = "Images/Open.png", ToolbarCategory = nameof(Resources.Open), ToolbarOrder = 0)] - [ExportMainMenuCommand(Menu = nameof(Resources._File), Header = nameof(Resources._Open), MenuIcon = "Images/Open.png", MenuCategory = nameof(Resources.Open), MenuOrder = 0)] + [ExportToolbarCommand(ToolTip = nameof(Resources.Open), ToolbarIcon = "Images/Open", ToolbarCategory = nameof(Resources.Open), ToolbarOrder = 0)] + [ExportMainMenuCommand(Menu = nameof(Resources._File), Header = nameof(Resources._Open), MenuIcon = "Images/Open", MenuCategory = nameof(Resources.Open), MenuOrder = 0)] sealed class OpenCommand : CommandWrapper { public OpenCommand() diff --git a/ILSpy/Commands/OpenFromGacCommand.cs b/ILSpy/Commands/OpenFromGacCommand.cs index 8f7f008e7..bcac992ce 100644 --- a/ILSpy/Commands/OpenFromGacCommand.cs +++ b/ILSpy/Commands/OpenFromGacCommand.cs @@ -19,7 +19,7 @@ using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy { - [ExportMainMenuCommand(Menu = nameof(Resources._File), Header = nameof(Resources.OpenFrom_GAC), MenuIcon = "Images/AssemblyListGAC.png", MenuCategory = nameof(Resources.Open), MenuOrder = 1)] + [ExportMainMenuCommand(Menu = nameof(Resources._File), Header = nameof(Resources.OpenFrom_GAC), MenuIcon = "Images/AssemblyListGAC", MenuCategory = nameof(Resources.Open), MenuOrder = 1)] sealed class OpenFromGacCommand : SimpleCommand { public override void Execute(object parameter) diff --git a/ILSpy/Commands/OpenListCommand.cs b/ILSpy/Commands/OpenListCommand.cs index e5fe22139..807171875 100644 --- a/ILSpy/Commands/OpenListCommand.cs +++ b/ILSpy/Commands/OpenListCommand.cs @@ -21,7 +21,7 @@ using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy { - [ExportMainMenuCommand(Menu = nameof(Resources._File), Header = nameof(Resources.Open_List), MenuIcon = "Images/AssemblyList.png", MenuCategory = nameof(Resources.Open), MenuOrder = 1.7)] + [ExportMainMenuCommand(Menu = nameof(Resources._File), Header = nameof(Resources.Open_List), MenuIcon = "Images/AssemblyList", MenuCategory = nameof(Resources.Open), MenuOrder = 1.7)] sealed class OpenListCommand : SimpleCommand { public override void Execute(object parameter) diff --git a/ILSpy/Commands/RefreshCommand.cs b/ILSpy/Commands/RefreshCommand.cs index 96e421882..bf92dc491 100644 --- a/ILSpy/Commands/RefreshCommand.cs +++ b/ILSpy/Commands/RefreshCommand.cs @@ -21,8 +21,8 @@ using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy { - [ExportToolbarCommand(ToolTip = nameof(Resources.RefreshCommand_ReloadAssemblies), ToolbarIcon = "Images/Refresh.png", ToolbarCategory = nameof(Resources.Open), ToolbarOrder = 2)] - [ExportMainMenuCommand(Menu = nameof(Resources._File), Header = nameof(Resources._Reload), MenuIcon = "Images/Refresh.png", MenuCategory = nameof(Resources.Open), MenuOrder = 2)] + [ExportToolbarCommand(ToolTip = nameof(Resources.RefreshCommand_ReloadAssemblies), ToolbarIcon = "Images/Refresh", ToolbarCategory = nameof(Resources.Open), ToolbarOrder = 2)] + [ExportMainMenuCommand(Menu = nameof(Resources._File), Header = nameof(Resources._Reload), MenuIcon = "Images/Refresh", MenuCategory = nameof(Resources.Open), MenuOrder = 2)] sealed class RefreshCommand : CommandWrapper { public RefreshCommand() diff --git a/ILSpy/Commands/SaveCodeContextMenuEntry.cs b/ILSpy/Commands/SaveCodeContextMenuEntry.cs index ef395f265..3715b588d 100644 --- a/ILSpy/Commands/SaveCodeContextMenuEntry.cs +++ b/ILSpy/Commands/SaveCodeContextMenuEntry.cs @@ -29,7 +29,7 @@ using Microsoft.Win32; namespace ICSharpCode.ILSpy.TextView { - [ExportContextMenuEntry(Header = nameof(Resources._SaveCode), Category = nameof(Resources.Save), Icon = "Images/SaveFile.png")] + [ExportContextMenuEntry(Header = nameof(Resources._SaveCode), Category = nameof(Resources.Save), Icon = "Images/Save")] sealed class SaveCodeContextMenuEntry : IContextMenuEntry { public void Execute(TextViewContext context) diff --git a/ILSpy/Commands/SaveCommand.cs b/ILSpy/Commands/SaveCommand.cs index 22da9c57c..fe18990ce 100644 --- a/ILSpy/Commands/SaveCommand.cs +++ b/ILSpy/Commands/SaveCommand.cs @@ -21,7 +21,7 @@ using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy { - [ExportMainMenuCommand(Menu = nameof(Resources._File), Header = nameof(Resources._SaveCode), MenuIcon = "Images/SaveFile.png", MenuCategory = nameof(Resources.Save), MenuOrder = 0)] + [ExportMainMenuCommand(Menu = nameof(Resources._File), Header = nameof(Resources._SaveCode), MenuIcon = "Images/Save", MenuCategory = nameof(Resources.Save), MenuOrder = 0)] sealed class SaveCommand : CommandWrapper { public SaveCommand() diff --git a/ILSpy/Commands/SortAssemblyListCommand.cs b/ILSpy/Commands/SortAssemblyListCommand.cs index b205cc03a..5347f61cc 100644 --- a/ILSpy/Commands/SortAssemblyListCommand.cs +++ b/ILSpy/Commands/SortAssemblyListCommand.cs @@ -23,8 +23,8 @@ using ICSharpCode.TreeView; namespace ICSharpCode.ILSpy { - [ExportMainMenuCommand(Menu = nameof(Resources._View), Header = nameof(Resources.SortAssembly_listName), MenuIcon = "Images/Sort.png", MenuCategory = nameof(Resources.View))] - [ExportToolbarCommand(ToolTip = nameof(Resources.SortAssemblyListName), ToolbarIcon = "Images/Sort.png", ToolbarCategory = nameof(Resources.View))] + [ExportMainMenuCommand(Menu = nameof(Resources._View), Header = nameof(Resources.SortAssembly_listName), MenuIcon = "Images/Sort", MenuCategory = nameof(Resources.View))] + [ExportToolbarCommand(ToolTip = nameof(Resources.SortAssemblyListName), ToolbarIcon = "Images/Sort", ToolbarCategory = nameof(Resources.View))] sealed class SortAssemblyListCommand : SimpleCommand, IComparer { public override void Execute(object parameter) @@ -39,8 +39,8 @@ namespace ICSharpCode.ILSpy } } - [ExportMainMenuCommand(Menu = nameof(Resources._View), Header = nameof(Resources._CollapseTreeNodes), MenuIcon = "Images/CollapseAll.png", MenuCategory = nameof(Resources.View))] - [ExportToolbarCommand(ToolTip = nameof(Resources.CollapseTreeNodes), ToolbarIcon = "Images/CollapseAll.png", ToolbarCategory = nameof(Resources.View))] + [ExportMainMenuCommand(Menu = nameof(Resources._View), Header = nameof(Resources._CollapseTreeNodes), MenuIcon = "Images/CollapseAll", MenuCategory = nameof(Resources.View))] + [ExportToolbarCommand(ToolTip = nameof(Resources.CollapseTreeNodes), ToolbarIcon = "Images/CollapseAll", ToolbarCategory = nameof(Resources.View))] sealed class CollapseAllCommand : SimpleCommand { public override void Execute(object parameter) diff --git a/ILSpy/ContextMenuEntry.cs b/ILSpy/ContextMenuEntry.cs index f2a94ae09..ce1f104d6 100644 --- a/ILSpy/ContextMenuEntry.cs +++ b/ILSpy/ContextMenuEntry.cs @@ -20,7 +20,7 @@ using System; using System.ComponentModel.Composition; using System.Linq; using System.Windows.Controls; - +using System.Windows.Media; using ICSharpCode.AvalonEdit; using ICSharpCode.ILSpy.TextView; using ICSharpCode.TreeView; @@ -222,11 +222,15 @@ namespace ICSharpCode.ILSpy menuItem.Header = MainWindow.GetResourceString( entryPair.Metadata.Header); menuItem.InputGestureText = entryPair.Metadata.InputGestureText; if (!string.IsNullOrEmpty(entryPair.Metadata.Icon)) { - menuItem.Icon = new Image { - Width = 16, - Height = 16, - Source = Images.LoadImage(entry, entryPair.Metadata.Icon) - }; + object image = Images.Load(entryPair.Value, entryPair.Metadata.Icon); + if (!(image is Viewbox)) { + image = new Image { + Width = 16, + Height = 16, + Source = (ImageSource)image + }; + } + menuItem.Icon = image; } if (entryPair.Value.IsEnabled(context)) { menuItem.Click += delegate { entry.Execute(context); }; diff --git a/ILSpy/Controls/SearchBoxStyle.xaml b/ILSpy/Controls/SearchBoxStyle.xaml index 80224dc9e..67c78eb99 100644 --- a/ILSpy/Controls/SearchBoxStyle.xaml +++ b/ILSpy/Controls/SearchBoxStyle.xaml @@ -43,7 +43,7 @@ HorizontalAlignment="Center" VerticalAlignment="Center" ToolTip="Search" - Source="pack://application:,,,/ILSpy;component/images/search.png" /> + Source="{local:XamlResource Images/Search}" /> @@ -57,7 +57,7 @@ + Value="{local:XamlResource Images/Close}" /> diff --git a/ILSpy/Controls/XamlResourceExtension.cs b/ILSpy/Controls/XamlResourceExtension.cs new file mode 100644 index 000000000..113c587f7 --- /dev/null +++ b/ILSpy/Controls/XamlResourceExtension.cs @@ -0,0 +1,38 @@ +// Copyright (c) 2011 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: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; +using System.Windows.Markup; + +namespace ICSharpCode.ILSpy.Controls +{ + class XamlResourceExtension : MarkupExtension + { + readonly string name; + + public XamlResourceExtension(string name) + { + this.name = name ?? throw new ArgumentNullException(nameof(name)); + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + return Images.Load(null, name); + } + } +} diff --git a/ILSpy/FilterSettings.cs b/ILSpy/FilterSettings.cs index e784f1c3c..788c3cc1f 100644 --- a/ILSpy/FilterSettings.cs +++ b/ILSpy/FilterSettings.cs @@ -94,29 +94,36 @@ namespace ICSharpCode.ILSpy } } - public bool ShowInternalApi { - get { return ShowApiLevel == ApiVisibility.PublicAndInternal; } + public bool ApiVisPublicOnly { + get { return showApiLevel == ApiVisibility.PublicOnly; } set { - if (ShowApiLevel == ApiVisibility.PublicAndInternal) { - ShowApiLevel = ApiVisibility.PublicOnly; - } else { - ShowApiLevel = ApiVisibility.PublicAndInternal; - } - OnPropertyChanged(nameof(ShowInternalApi)); - OnPropertyChanged(nameof(ShowAllApi)); + if (value == (showApiLevel == ApiVisibility.PublicOnly)) return; + ShowApiLevel = ApiVisibility.PublicOnly; + OnPropertyChanged(nameof(ApiVisPublicOnly)); + OnPropertyChanged(nameof(ApiVisPublicAndInternal)); + OnPropertyChanged(nameof(ApiVisAll)); } } - public bool ShowAllApi { - get { return ShowApiLevel == ApiVisibility.All; } + public bool ApiVisPublicAndInternal { + get { return showApiLevel == ApiVisibility.PublicAndInternal; } set { - if (ShowApiLevel == ApiVisibility.All) { - ShowApiLevel = ApiVisibility.PublicOnly; - } else { - ShowApiLevel = ApiVisibility.All; - } - OnPropertyChanged(nameof(ShowInternalApi)); - OnPropertyChanged(nameof(ShowAllApi)); + if (value == (showApiLevel == ApiVisibility.PublicAndInternal)) return; + ShowApiLevel = ApiVisibility.PublicAndInternal; + OnPropertyChanged(nameof(ApiVisPublicOnly)); + OnPropertyChanged(nameof(ApiVisPublicAndInternal)); + OnPropertyChanged(nameof(ApiVisAll)); + } + } + + public bool ApiVisAll { + get { return showApiLevel == ApiVisibility.All; } + set { + if (value == (showApiLevel == ApiVisibility.All)) return; + ShowApiLevel = ApiVisibility.All; + OnPropertyChanged(nameof(ApiVisPublicOnly)); + OnPropertyChanged(nameof(ApiVisPublicAndInternal)); + OnPropertyChanged(nameof(ApiVisAll)); } } diff --git a/ILSpy/ILSpy.csproj b/ILSpy/ILSpy.csproj index 092f5edec..ad27aafa4 100644 --- a/ILSpy/ILSpy.csproj +++ b/ILSpy/ILSpy.csproj @@ -2,7 +2,7 @@ - net462 + net472 WinExe 7.2 False @@ -49,8 +49,7 @@ - - + @@ -61,6 +60,10 @@ + + + + @@ -126,6 +129,7 @@ + CreateListDialog.xaml @@ -254,24 +258,10 @@ Resources.Designer.cs - - - - - - - - - - - - - - @@ -314,6 +304,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -327,70 +379,228 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + + + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + MSBuild:Compile diff --git a/ILSpy/Images/Assembly.png b/ILSpy/Images/Assembly.png deleted file mode 100644 index 42d74fc46..000000000 Binary files a/ILSpy/Images/Assembly.png and /dev/null differ diff --git a/ILSpy/Images/Assembly.svg b/ILSpy/Images/Assembly.svg new file mode 100644 index 000000000..f07e9ec99 --- /dev/null +++ b/ILSpy/Images/Assembly.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Assembly.xaml b/ILSpy/Images/Assembly.xaml new file mode 100644 index 000000000..3f7ffdc99 --- /dev/null +++ b/ILSpy/Images/Assembly.xaml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/ILSpy/Images/AssemblyList.png b/ILSpy/Images/AssemblyList.png deleted file mode 100644 index 0608070a1..000000000 Binary files a/ILSpy/Images/AssemblyList.png and /dev/null differ diff --git a/ILSpy/Images/AssemblyList.svg b/ILSpy/Images/AssemblyList.svg new file mode 100644 index 000000000..948ca46b1 --- /dev/null +++ b/ILSpy/Images/AssemblyList.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/AssemblyList.xaml b/ILSpy/Images/AssemblyList.xaml new file mode 100644 index 000000000..33a32f40a --- /dev/null +++ b/ILSpy/Images/AssemblyList.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/AssemblyListGAC.png b/ILSpy/Images/AssemblyListGAC.png deleted file mode 100644 index 9f2e124c9..000000000 Binary files a/ILSpy/Images/AssemblyListGAC.png and /dev/null differ diff --git a/ILSpy/Images/AssemblyListGAC.svg b/ILSpy/Images/AssemblyListGAC.svg new file mode 100644 index 000000000..80bae75f6 --- /dev/null +++ b/ILSpy/Images/AssemblyListGAC.svg @@ -0,0 +1,84 @@ + +image/svg+xml \ No newline at end of file diff --git a/ILSpy/Images/AssemblyListGAC.xaml b/ILSpy/Images/AssemblyListGAC.xaml new file mode 100644 index 000000000..2a779232d --- /dev/null +++ b/ILSpy/Images/AssemblyListGAC.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/AssemblyWarning.png b/ILSpy/Images/AssemblyWarning.png deleted file mode 100644 index 8c2527c60..000000000 Binary files a/ILSpy/Images/AssemblyWarning.png and /dev/null differ diff --git a/ILSpy/Images/AssemblyWarning.svg b/ILSpy/Images/AssemblyWarning.svg new file mode 100644 index 000000000..1a7d200c1 --- /dev/null +++ b/ILSpy/Images/AssemblyWarning.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/AssemblyWarning.xaml b/ILSpy/Images/AssemblyWarning.xaml new file mode 100644 index 000000000..6b3c3531a --- /dev/null +++ b/ILSpy/Images/AssemblyWarning.xaml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/ILSpy/Images/Back.png b/ILSpy/Images/Back.png deleted file mode 100644 index e3f39762c..000000000 Binary files a/ILSpy/Images/Back.png and /dev/null differ diff --git a/ILSpy/Images/Back.svg b/ILSpy/Images/Back.svg new file mode 100644 index 000000000..4a752dbc9 --- /dev/null +++ b/ILSpy/Images/Back.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Back.xaml b/ILSpy/Images/Back.xaml new file mode 100644 index 000000000..7ddf0a4df --- /dev/null +++ b/ILSpy/Images/Back.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/Break.png b/ILSpy/Images/Break.png deleted file mode 100644 index bf82382f3..000000000 Binary files a/ILSpy/Images/Break.png and /dev/null differ diff --git a/ILSpy/Images/Breakpoint.png b/ILSpy/Images/Breakpoint.png deleted file mode 100644 index a3360ed4b..000000000 Binary files a/ILSpy/Images/Breakpoint.png and /dev/null differ diff --git a/ILSpy/Images/Class.png b/ILSpy/Images/Class.png deleted file mode 100644 index d62ac8b9d..000000000 Binary files a/ILSpy/Images/Class.png and /dev/null differ diff --git a/ILSpy/Images/Class.svg b/ILSpy/Images/Class.svg new file mode 100644 index 000000000..e553c3633 --- /dev/null +++ b/ILSpy/Images/Class.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Class.xaml b/ILSpy/Images/Class.xaml new file mode 100644 index 000000000..465fa3ca4 --- /dev/null +++ b/ILSpy/Images/Class.xaml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/ClearSearch.png b/ILSpy/Images/ClearSearch.png deleted file mode 100644 index c5a496bbb..000000000 Binary files a/ILSpy/Images/ClearSearch.png and /dev/null differ diff --git a/ILSpy/Images/Close.svg b/ILSpy/Images/Close.svg new file mode 100644 index 000000000..d68f1ae0e --- /dev/null +++ b/ILSpy/Images/Close.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Close.xaml b/ILSpy/Images/Close.xaml new file mode 100644 index 000000000..6543d2d3c --- /dev/null +++ b/ILSpy/Images/Close.xaml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/CollapseAll.png b/ILSpy/Images/CollapseAll.png deleted file mode 100644 index 5e23dbc81..000000000 Binary files a/ILSpy/Images/CollapseAll.png and /dev/null differ diff --git a/ILSpy/Images/CollapseAll.svg b/ILSpy/Images/CollapseAll.svg new file mode 100644 index 000000000..a7b706705 --- /dev/null +++ b/ILSpy/Images/CollapseAll.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/CollapseAll.xaml b/ILSpy/Images/CollapseAll.xaml new file mode 100644 index 000000000..e0d9a09cd --- /dev/null +++ b/ILSpy/Images/CollapseAll.xaml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/Constructor.png b/ILSpy/Images/Constructor.png deleted file mode 100644 index 0e5f9cf47..000000000 Binary files a/ILSpy/Images/Constructor.png and /dev/null differ diff --git a/ILSpy/Images/Constructor.svg b/ILSpy/Images/Constructor.svg new file mode 100644 index 000000000..3ca6aedac --- /dev/null +++ b/ILSpy/Images/Constructor.svg @@ -0,0 +1,70 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/ILSpy/Images/Constructor.xaml b/ILSpy/Images/Constructor.xaml new file mode 100644 index 000000000..19466af25 --- /dev/null +++ b/ILSpy/Images/Constructor.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/ILSpy/Images/Copy.png b/ILSpy/Images/Copy.png deleted file mode 100644 index d131f3636..000000000 Binary files a/ILSpy/Images/Copy.png and /dev/null differ diff --git a/ILSpy/Images/Copy.svg b/ILSpy/Images/Copy.svg new file mode 100644 index 000000000..3de60b008 --- /dev/null +++ b/ILSpy/Images/Copy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Copy.xaml b/ILSpy/Images/Copy.xaml new file mode 100644 index 000000000..155cead10 --- /dev/null +++ b/ILSpy/Images/Copy.xaml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/CurrentLine.png b/ILSpy/Images/CurrentLine.png deleted file mode 100644 index 600613792..000000000 Binary files a/ILSpy/Images/CurrentLine.png and /dev/null differ diff --git a/ILSpy/Images/Delegate.png b/ILSpy/Images/Delegate.png deleted file mode 100644 index ab3ebb548..000000000 Binary files a/ILSpy/Images/Delegate.png and /dev/null differ diff --git a/ILSpy/Images/Delegate.svg b/ILSpy/Images/Delegate.svg new file mode 100644 index 000000000..1ba71123f --- /dev/null +++ b/ILSpy/Images/Delegate.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Delegate.xaml b/ILSpy/Images/Delegate.xaml new file mode 100644 index 000000000..268ddb36e --- /dev/null +++ b/ILSpy/Images/Delegate.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/Delete.png b/ILSpy/Images/Delete.png deleted file mode 100644 index 70b59dc9d..000000000 Binary files a/ILSpy/Images/Delete.png and /dev/null differ diff --git a/ILSpy/Images/Delete.svg b/ILSpy/Images/Delete.svg new file mode 100644 index 000000000..0e2c9437e --- /dev/null +++ b/ILSpy/Images/Delete.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Delete.xaml b/ILSpy/Images/Delete.xaml new file mode 100644 index 000000000..ce1d2d715 --- /dev/null +++ b/ILSpy/Images/Delete.xaml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/DisabledBreakpoint.png b/ILSpy/Images/DisabledBreakpoint.png deleted file mode 100644 index bba8f656d..000000000 Binary files a/ILSpy/Images/DisabledBreakpoint.png and /dev/null differ diff --git a/ILSpy/Images/Enum.png b/ILSpy/Images/Enum.png deleted file mode 100644 index 11bee284b..000000000 Binary files a/ILSpy/Images/Enum.png and /dev/null differ diff --git a/ILSpy/Images/Enum.svg b/ILSpy/Images/Enum.svg new file mode 100644 index 000000000..010d59d77 --- /dev/null +++ b/ILSpy/Images/Enum.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Enum.xaml b/ILSpy/Images/Enum.xaml new file mode 100644 index 000000000..7f40a3518 --- /dev/null +++ b/ILSpy/Images/Enum.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/EnumValue.png b/ILSpy/Images/EnumValue.png deleted file mode 100644 index de68fc44a..000000000 Binary files a/ILSpy/Images/EnumValue.png and /dev/null differ diff --git a/ILSpy/Images/EnumValue.svg b/ILSpy/Images/EnumValue.svg new file mode 100644 index 000000000..aa901ec19 --- /dev/null +++ b/ILSpy/Images/EnumValue.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/EnumValue.xaml b/ILSpy/Images/EnumValue.xaml new file mode 100644 index 000000000..14d6bc387 --- /dev/null +++ b/ILSpy/Images/EnumValue.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/Event.png b/ILSpy/Images/Event.png deleted file mode 100644 index 668e61730..000000000 Binary files a/ILSpy/Images/Event.png and /dev/null differ diff --git a/ILSpy/Images/Event.svg b/ILSpy/Images/Event.svg new file mode 100644 index 000000000..e874ec217 --- /dev/null +++ b/ILSpy/Images/Event.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Event.xaml b/ILSpy/Images/Event.xaml new file mode 100644 index 000000000..cbf6d0879 --- /dev/null +++ b/ILSpy/Images/Event.xaml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ILSpy/Images/ExtensionMethod.png b/ILSpy/Images/ExtensionMethod.png deleted file mode 100644 index b9954df1c..000000000 Binary files a/ILSpy/Images/ExtensionMethod.png and /dev/null differ diff --git a/ILSpy/Images/ExtensionMethod.svg b/ILSpy/Images/ExtensionMethod.svg new file mode 100644 index 000000000..999349160 --- /dev/null +++ b/ILSpy/Images/ExtensionMethod.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/ExtensionMethod.xaml b/ILSpy/Images/ExtensionMethod.xaml new file mode 100644 index 000000000..e7c4ad20c --- /dev/null +++ b/ILSpy/Images/ExtensionMethod.xaml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/ILSpy/Images/Field.png b/ILSpy/Images/Field.png deleted file mode 100644 index 4cef2c580..000000000 Binary files a/ILSpy/Images/Field.png and /dev/null differ diff --git a/ILSpy/Images/Field.svg b/ILSpy/Images/Field.svg new file mode 100644 index 000000000..e1b5aa5e3 --- /dev/null +++ b/ILSpy/Images/Field.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Field.xaml b/ILSpy/Images/Field.xaml new file mode 100644 index 000000000..c432096c8 --- /dev/null +++ b/ILSpy/Images/Field.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ILSpy/Images/FieldReadOnly.png b/ILSpy/Images/FieldReadOnly.png deleted file mode 100644 index b3c355a3d..000000000 Binary files a/ILSpy/Images/FieldReadOnly.png and /dev/null differ diff --git a/ILSpy/Images/FieldReadOnly.svg b/ILSpy/Images/FieldReadOnly.svg new file mode 100644 index 000000000..c79e4b2d6 --- /dev/null +++ b/ILSpy/Images/FieldReadOnly.svg @@ -0,0 +1,69 @@ + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/ILSpy/Images/FieldReadOnly.xaml b/ILSpy/Images/FieldReadOnly.xaml new file mode 100644 index 000000000..2359f6d35 --- /dev/null +++ b/ILSpy/Images/FieldReadOnly.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/Find.png b/ILSpy/Images/Find.png deleted file mode 100644 index 7a5ae62e3..000000000 Binary files a/ILSpy/Images/Find.png and /dev/null differ diff --git a/ILSpy/Images/FindAssembly.png b/ILSpy/Images/FindAssembly.png deleted file mode 100644 index 3b1c28972..000000000 Binary files a/ILSpy/Images/FindAssembly.png and /dev/null differ diff --git a/ILSpy/Images/FindAssembly.svg b/ILSpy/Images/FindAssembly.svg new file mode 100644 index 000000000..ab9d7c6f2 --- /dev/null +++ b/ILSpy/Images/FindAssembly.svg @@ -0,0 +1,93 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/ILSpy/Images/FindAssembly.xaml b/ILSpy/Images/FindAssembly.xaml new file mode 100644 index 000000000..ac945aa76 --- /dev/null +++ b/ILSpy/Images/FindAssembly.xaml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/Folder.Closed.png b/ILSpy/Images/Folder.Closed.png deleted file mode 100644 index 5d4c6e404..000000000 Binary files a/ILSpy/Images/Folder.Closed.png and /dev/null differ diff --git a/ILSpy/Images/Folder.Closed.svg b/ILSpy/Images/Folder.Closed.svg new file mode 100644 index 000000000..481bb01ac --- /dev/null +++ b/ILSpy/Images/Folder.Closed.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Folder.Closed.xaml b/ILSpy/Images/Folder.Closed.xaml new file mode 100644 index 000000000..b6956e77e --- /dev/null +++ b/ILSpy/Images/Folder.Closed.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ILSpy/Images/Folder.Open.png b/ILSpy/Images/Folder.Open.png deleted file mode 100644 index aea0fda75..000000000 Binary files a/ILSpy/Images/Folder.Open.png and /dev/null differ diff --git a/ILSpy/Images/Folder.Open.xaml b/ILSpy/Images/Folder.Open.xaml new file mode 100644 index 000000000..fdbccfc54 --- /dev/null +++ b/ILSpy/Images/Folder.Open.xaml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ILSpy/Images/FolderOpen.svg b/ILSpy/Images/FolderOpen.svg new file mode 100644 index 000000000..4c8a03f5b --- /dev/null +++ b/ILSpy/Images/FolderOpen.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Forward.png b/ILSpy/Images/Forward.png deleted file mode 100644 index d6c52613d..000000000 Binary files a/ILSpy/Images/Forward.png and /dev/null differ diff --git a/ILSpy/Images/Forward.svg b/ILSpy/Images/Forward.svg new file mode 100644 index 000000000..b47d19598 --- /dev/null +++ b/ILSpy/Images/Forward.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Forward.xaml b/ILSpy/Images/Forward.xaml new file mode 100644 index 000000000..85efa5c2a --- /dev/null +++ b/ILSpy/Images/Forward.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/ILSpyNewIconList.txt b/ILSpy/Images/ILSpyNewIconList.txt deleted file mode 100644 index deeeaf3e2..000000000 --- a/ILSpy/Images/ILSpyNewIconList.txt +++ /dev/null @@ -1,61 +0,0 @@ -Currently used in ILSpy #D Icon - -Assembly.png ClassBrowserIcons\Icons.16x16.Reference.png -AssemblyList.png new (Fugue-Icon-Mashup) -AssemblyWarning.png new (Fugue-Icon-Mashup) -Back.png BitmapResources-data\Icons.16x16.BrowserBefore.png -Breakpoint.png Bookmarks\Breakpoint.png -Class.png ClassBrowserIcons\Icons.16x16.Class.png -ClearSearch.png new (Fugue: Cross-white.png) -Constructor.png new (SharpDevelop-Team) -CurrentLine.png BitmapResources-Data\Icons.16x16.SelectionArrow.png -Delegate.png ClassBrowserIcons\Icons.16x16.Delegate.png -Delete.png BitmapResources-data\Icons.16x16.DeleteIcon.png -DisabledBreakpoint.png Bookmarks\DisabledBreakpoint.png -Enum.png ClassBrowserIcons\Icons.16x16.Enum.png -EnumValue.png new (SharpDevelop-Team) -Event.png ClassBrowserIcons\Icons.16x16.Event.png -ExtensionMethod.png ClassBrowserIcons\Icons.16x16.ExtensionMethod.png -Field.png ClassBrowserIcons\Icons.16x16.Field.png -FieldReadOnly.png new (SharpDevelop-Team) -Find.png BitmapResources-data\Icons.16x16.FindIcon.png -FindAssembly.png new (Fugue-Icon-Mashup) -Folder.Closed.png ClassBrowserIcons\Folder.Closed.png -Folder.Open.png ClassBrowserIcons\Folder.Open.png -Forward.png BitmapResources-Data\Icons.16x16.BrowserAfter.png -Indexer.png ClassBrowserIcons\Icons.16x16.Indexer.png -Interface.png ClassBrowserIcons\Icons.16x16.Interface.png -Library.png new (Fugue derived) -Literal.png ClassBrowserIcons\Icons.16x16.Literal.png -Method.png ClassBrowserIcons\Icons.16x16.Method.png -NameSpace.png ClassBrowserIcons\Icons.16x16.NameSpace.png -OK.png BitmapResources-data\Icons.16x16.OK.png -Open.png BitmapResources-data\Icons.16x16.OpenFileIcon.png -Operator.png ClassBrowserIcons\Icons.16x16.Operator.png -OverlayCompilerControlled.png new (Fugue derived) -OverlayInternal.png new (Fugue derived) -OverlayPrivate.png new (Fugue derived) -OverlayProtected.png new (Fugue derived) -OverlayProtectedInternal.png new (Fugue derived) -OverlayStatic.png new (Fugue derived) -PInvokeMethod.png new (Fugue-Icon-Mashup) -OverlayPrivateProtected.png new (Fugue derived) -Property.png ClassBrowserIcons\Icons.16x16.Property.png -ReferenceFolder.Closed.png ProjectBrowserIcons\ReferenceFolder.Closed.png -ReferenceFolder.Open.png ProjectBrowserIcons\ReferenceFolder.Open.png -Refresh.png BitmapResources-data\Icons.16x16.Refresh.png -Resource.png BitmapResources-data\Icons.16x16.SideBarDocument.png -ResourceImage.png BitmapResources-data\Icons.16x16.ResourceEditor.bmp.png -ResourceResourcesFile.png new (Fugue-Icon-Mashup) -ResourceXml.png backendicons\miscFiles\Icons.16x16.XMLFileIcon.png -ResourceXsd.png backendicons\miscFiles\XSD_16.png -ResourceXslt.png backendicons\miscFiles\XSL_16.png -SaveFile.png BitmapResources-data\Icons.16x16.SaveIcon.png -Search.png BitmapResources-data\Icons.16x16.FindIcon.png -StaticClass.png new (Fugue-Icon-Mashup) -Struct.png ClassBrowserIcons\Icons.16x16.Struct.png -SubTypes.png new (Fugue: arrow-turn-270.png) -SuperTypes.png new (Fugue: arrow-turn-090-left.png) -ViewCode.png BitmapResources-data\Icons.16x16.FormsDesigner.ViewCode.png -VirtualMethod.png new (SharpDevelop-Team) -Warning.png new (Fugue: exclamation.png (32x32)) \ No newline at end of file diff --git a/ILSpy/Images/Images.cs b/ILSpy/Images/Images.cs index 61ed764d8..e0a1e4b18 100644 --- a/ILSpy/Images/Images.cs +++ b/ILSpy/Images/Images.cs @@ -21,100 +21,137 @@ using System.Windows.Media.Imaging; using System.Windows.Media; using System.Windows; using System.Collections.Generic; +using System.Windows.Controls; +using System.Windows.Markup; +using System.IO; +using System.Windows.Shapes; namespace ICSharpCode.ILSpy { static class Images { - static BitmapImage LoadBitmap(string name) + static ImageSource Load(string icon) { - BitmapImage image = new BitmapImage(new Uri("pack://application:,,,/Images/" + name + ".png")); - image.Freeze(); - return image; + return new DrawingImage(LoadDrawingGroup(null, "Images/" + icon)); } - - public static readonly BitmapImage Breakpoint = LoadBitmap("Breakpoint"); - public static readonly BitmapImage CurrentLine = LoadBitmap("CurrentLine"); - public static readonly BitmapImage ViewCode = LoadBitmap("ViewCode"); - public static readonly BitmapImage Save = LoadBitmap("SaveFile"); - public static readonly BitmapImage OK = LoadBitmap("OK"); + public static readonly ImageSource ViewCode = Load("ViewCode"); + public static readonly ImageSource Save = Load("Save"); + public static readonly ImageSource OK = Load("OK"); - public static readonly BitmapImage Delete = LoadBitmap("Delete"); - public static readonly BitmapImage Search = LoadBitmap("Search"); + public static readonly ImageSource Delete = Load("Delete"); + public static readonly ImageSource Search = Load("Search"); - public static readonly BitmapImage Assembly = LoadBitmap("Assembly"); - public static readonly BitmapImage AssemblyWarning = LoadBitmap("AssemblyWarning"); - public static readonly BitmapImage AssemblyLoading = LoadBitmap("FindAssembly"); + public static readonly ImageSource Assembly = Load("Assembly"); + public static readonly ImageSource AssemblyWarning = Load("AssemblyWarning"); + public static readonly ImageSource FindAssembly = Load("FindAssembly"); - public static readonly BitmapImage Library = LoadBitmap("Library"); - public static readonly BitmapImage Namespace = LoadBitmap("NameSpace"); + public static readonly ImageSource Library = Load("Library"); + public static readonly ImageSource Namespace = Load("Namespace"); - public static readonly BitmapImage ReferenceFolderOpen = LoadBitmap("ReferenceFolder.Open"); - public static readonly BitmapImage ReferenceFolderClosed = LoadBitmap("ReferenceFolder.Closed"); + public static readonly ImageSource ReferenceFolder = Load("ReferenceFolder"); - public static readonly BitmapImage SubTypes = LoadBitmap("SubTypes"); - public static readonly BitmapImage SuperTypes = LoadBitmap("SuperTypes"); + public static readonly ImageSource SubTypes = Load("SubTypes"); + public static readonly ImageSource SuperTypes = Load("SuperTypes"); - public static readonly BitmapImage FolderOpen = LoadBitmap("Folder.Open"); - public static readonly BitmapImage FolderClosed = LoadBitmap("Folder.Closed"); + public static readonly ImageSource FolderOpen = Load("Folder.Open"); + public static readonly ImageSource FolderClosed = Load("Folder.Closed"); - public static readonly BitmapImage Resource = LoadBitmap("Resource"); - public static readonly BitmapImage ResourceImage = LoadBitmap("ResourceImage"); - public static readonly BitmapImage ResourceResourcesFile = LoadBitmap("ResourceResourcesFile"); - public static readonly BitmapImage ResourceXml = LoadBitmap("ResourceXml"); - public static readonly BitmapImage ResourceXsd = LoadBitmap("ResourceXsd"); - public static readonly BitmapImage ResourceXslt = LoadBitmap("ResourceXslt"); + public static readonly ImageSource Resource = Load("Resource"); + public static readonly ImageSource ResourceImage = Load("ResourceImage"); + public static readonly ImageSource ResourceResourcesFile = Load("ResourceResourcesFile"); + public static readonly ImageSource ResourceXml = Load("ResourceXml"); + public static readonly ImageSource ResourceXsd = Load("ResourceXslt"); + public static readonly ImageSource ResourceXslt = Load("ResourceXslt"); - public static readonly BitmapImage Class = LoadBitmap("Class"); - public static readonly BitmapImage Struct = LoadBitmap("Struct"); - public static readonly BitmapImage Interface = LoadBitmap("Interface"); - public static readonly BitmapImage Delegate = LoadBitmap("Delegate"); - public static readonly BitmapImage Enum = LoadBitmap("Enum"); - public static readonly BitmapImage StaticClass = LoadBitmap("StaticClass"); + public static readonly ImageSource Class = Load("Class"); + public static readonly ImageSource Struct = Load("Struct"); + public static readonly ImageSource Interface = Load("Interface"); + public static readonly ImageSource Delegate = Load("Delegate"); + public static readonly ImageSource Enum = Load("Enum"); + public static readonly ImageSource Field = Load("Field"); + public static readonly ImageSource FieldReadOnly = Load("FieldReadOnly"); + public static readonly ImageSource Literal = Load("Literal"); + public static readonly ImageSource EnumValue = Load("EnumValue"); - public static readonly BitmapImage Field = LoadBitmap("Field"); - public static readonly BitmapImage FieldReadOnly = LoadBitmap("FieldReadOnly"); - public static readonly BitmapImage Literal = LoadBitmap("Literal"); - public static readonly BitmapImage EnumValue = LoadBitmap("EnumValue"); + public static readonly ImageSource Method = Load("Method"); + public static readonly ImageSource Constructor = Load("Constructor"); + public static readonly ImageSource VirtualMethod = Load("VirtualMethod"); + public static readonly ImageSource Operator = Load("Operator"); + public static readonly ImageSource ExtensionMethod = Load("ExtensionMethod"); + public static readonly ImageSource PInvokeMethod = Load("PInvokeMethod"); - public static readonly BitmapImage Method = LoadBitmap("Method"); - public static readonly BitmapImage Constructor = LoadBitmap("Constructor"); - public static readonly BitmapImage VirtualMethod = LoadBitmap("VirtualMethod"); - public static readonly BitmapImage Operator = LoadBitmap("Operator"); - public static readonly BitmapImage ExtensionMethod = LoadBitmap("ExtensionMethod"); - public static readonly BitmapImage PInvokeMethod = LoadBitmap("PInvokeMethod"); + public static readonly ImageSource Property = Load("Property"); + public static readonly ImageSource Indexer = Load("Indexer"); - public static readonly BitmapImage Property = LoadBitmap("Property"); - public static readonly BitmapImage Indexer = LoadBitmap("Indexer"); + public static readonly ImageSource Event = Load("Event"); - public static readonly BitmapImage Event = LoadBitmap("Event"); + private static readonly ImageSource OverlayProtected = Load("OverlayProtected"); + private static readonly ImageSource OverlayInternal = Load("OverlayInternal"); + private static readonly ImageSource OverlayProtectedInternal = Load("OverlayProtectedInternal"); + private static readonly ImageSource OverlayPrivate = Load("OverlayPrivate"); + private static readonly ImageSource OverlayPrivateProtected = Load("OverlayPrivateProtected"); + private static readonly ImageSource OverlayCompilerControlled = Load("OverlayCompilerControlled"); - private static readonly BitmapImage OverlayProtected = LoadBitmap("OverlayProtected"); - private static readonly BitmapImage OverlayInternal = LoadBitmap("OverlayInternal"); - private static readonly BitmapImage OverlayProtectedInternal = LoadBitmap("OverlayProtectedInternal"); - private static readonly BitmapImage OverlayPrivate = LoadBitmap("OverlayPrivate"); - private static readonly BitmapImage OverlayPrivateProtected = LoadBitmap("OverlayPrivateProtected"); - private static readonly BitmapImage OverlayCompilerControlled = LoadBitmap("OverlayCompilerControlled"); + private static readonly ImageSource OverlayStatic = Load("OverlayStatic"); - private static readonly BitmapImage OverlayStatic = LoadBitmap("OverlayStatic"); + public static ImageSource Load(object part, string icon) + { + if (icon.EndsWith(".png", StringComparison.OrdinalIgnoreCase)) + return LoadImage(part, icon); + Uri uri = GetUri(part, icon + ".xaml"); + if (ResourceExists(uri)) { + return new DrawingImage(LoadDrawingGroup(part, icon)); + } + return LoadImage(part, icon + ".png"); + } - public static BitmapImage LoadImage(object part, string icon) + static BitmapImage LoadImage(object part, string icon) + { + Uri uri = GetUri(part, icon); + BitmapImage image = new BitmapImage(uri); + image.Freeze(); + return image; + } + + public static Drawing LoadDrawingGroup(object part, string icon) + { + return (Drawing)Application.LoadComponent(GetUri(part, icon + ".xaml", absolute: false)); + } + + private static Uri GetUri(object part, string icon, bool absolute = true) { Uri uri; - var assembly = part.GetType().Assembly; - if (assembly == typeof(Images).Assembly) { - uri = new Uri("pack://application:,,,/" + icon); + var assembly = part?.GetType().Assembly; + string prefix; + UriKind kind; + if (absolute) { + prefix = "pack://application:,,,/"; + kind = UriKind.Absolute; + } else { + prefix = "/"; + kind = UriKind.Relative; + } + if (part == null || assembly == typeof(Images).Assembly) { + uri = new Uri(prefix + icon, kind); } else { var name = assembly.GetName(); - uri = new Uri("pack://application:,,,/" + name.Name + ";v" + name.Version + ";component/" + icon); + uri = new Uri(prefix + name.Name + ";v" + name.Version + ";component/" + icon, kind); } - BitmapImage image = new BitmapImage(uri); - image.Freeze(); - return image; + + return uri; } + private static bool ResourceExists(Uri uri) + { + try { + Application.GetResourceStream(uri); + return true; + } catch (IOException) { + return false; + } + } private static readonly TypeIconCache typeIconCache = new TypeIconCache(); private static readonly MemberIconCache memberIconCache = new MemberIconCache(); @@ -142,7 +179,6 @@ namespace ICSharpCode.ILSpy PreloadPublicIconToCache(TypeIcon.Struct, Images.Struct); PreloadPublicIconToCache(TypeIcon.Interface, Images.Interface); PreloadPublicIconToCache(TypeIcon.Delegate, Images.Delegate); - PreloadPublicIconToCache(TypeIcon.StaticClass, Images.StaticClass); } protected override ImageSource GetBaseImage(TypeIcon icon) @@ -164,9 +200,6 @@ namespace ICSharpCode.ILSpy case TypeIcon.Delegate: baseImage = Images.Delegate; break; - case TypeIcon.StaticClass: - baseImage = Images.StaticClass; - break; default: throw new ArgumentOutOfRangeException(nameof(icon), $"TypeIcon.{icon} is not supported!"); } @@ -247,17 +280,17 @@ namespace ICSharpCode.ILSpy private abstract class IconCache { - private readonly Dictionary, ImageSource> cache = new Dictionary, ImageSource>(); + private readonly Dictionary<(T, AccessOverlayIcon, bool), ImageSource> cache = new Dictionary<(T, AccessOverlayIcon, bool), ImageSource>(); protected void PreloadPublicIconToCache(T icon, ImageSource image) { - var iconKey = new Tuple(icon, AccessOverlayIcon.Public, false); + var iconKey = (icon, AccessOverlayIcon.Public, false); cache.Add(iconKey, image); } public ImageSource GetIcon(T icon, AccessOverlayIcon overlay, bool isStatic) { - var iconKey = new Tuple(icon, overlay, isStatic); + var iconKey = (icon, overlay, isStatic); if (cache.ContainsKey(iconKey)) { return cache[iconKey]; } else { @@ -314,10 +347,15 @@ namespace ICSharpCode.ILSpy { var group = new DrawingGroup(); - group.Children.Add(new ImageDrawing(baseImage, iconRect)); + Drawing baseDrawing = new ImageDrawing(baseImage, iconRect); if (overlay != null) { + var nestedGroup = new DrawingGroup { Transform = new ScaleTransform(0.8, 0.8) }; + nestedGroup.Children.Add(baseDrawing); + group.Children.Add(nestedGroup); group.Children.Add(new ImageDrawing(overlay, iconRect)); + } else { + group.Children.Add(baseDrawing); } if (isStatic) { diff --git a/ILSpy/Images/Indexer.png b/ILSpy/Images/Indexer.png deleted file mode 100644 index c87a3b1a9..000000000 Binary files a/ILSpy/Images/Indexer.png and /dev/null differ diff --git a/ILSpy/Images/Indexer.svg b/ILSpy/Images/Indexer.svg new file mode 100644 index 000000000..ff55f31ff --- /dev/null +++ b/ILSpy/Images/Indexer.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Indexer.xaml b/ILSpy/Images/Indexer.xaml new file mode 100644 index 000000000..053a93e5d --- /dev/null +++ b/ILSpy/Images/Indexer.xaml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ILSpy/Images/Interface.png b/ILSpy/Images/Interface.png deleted file mode 100644 index 906a8ef07..000000000 Binary files a/ILSpy/Images/Interface.png and /dev/null differ diff --git a/ILSpy/Images/Interface.svg b/ILSpy/Images/Interface.svg new file mode 100644 index 000000000..0c08c8d50 --- /dev/null +++ b/ILSpy/Images/Interface.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Interface.xaml b/ILSpy/Images/Interface.xaml new file mode 100644 index 000000000..86ca1ef23 --- /dev/null +++ b/ILSpy/Images/Interface.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/Library.png b/ILSpy/Images/Library.png deleted file mode 100644 index 7524cadf5..000000000 Binary files a/ILSpy/Images/Library.png and /dev/null differ diff --git a/ILSpy/Images/Library.svg b/ILSpy/Images/Library.svg new file mode 100644 index 000000000..0ffa85f60 --- /dev/null +++ b/ILSpy/Images/Library.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Library.xaml b/ILSpy/Images/Library.xaml new file mode 100644 index 000000000..d1a8a5f86 --- /dev/null +++ b/ILSpy/Images/Library.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/ILSpy/Images/Literal.png b/ILSpy/Images/Literal.png deleted file mode 100644 index a6b6ef7cb..000000000 Binary files a/ILSpy/Images/Literal.png and /dev/null differ diff --git a/ILSpy/Images/Literal.svg b/ILSpy/Images/Literal.svg new file mode 100644 index 000000000..45c0171e7 --- /dev/null +++ b/ILSpy/Images/Literal.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Literal.xaml b/ILSpy/Images/Literal.xaml new file mode 100644 index 000000000..693bba38e --- /dev/null +++ b/ILSpy/Images/Literal.xaml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/ILSpy/Images/Method.png b/ILSpy/Images/Method.png deleted file mode 100644 index 5406c68da..000000000 Binary files a/ILSpy/Images/Method.png and /dev/null differ diff --git a/ILSpy/Images/Method.svg b/ILSpy/Images/Method.svg new file mode 100644 index 000000000..9706fa408 --- /dev/null +++ b/ILSpy/Images/Method.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Method.xaml b/ILSpy/Images/Method.xaml new file mode 100644 index 000000000..784ade333 --- /dev/null +++ b/ILSpy/Images/Method.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ILSpy/Images/NameSpace.png b/ILSpy/Images/NameSpace.png deleted file mode 100644 index b240c5e08..000000000 Binary files a/ILSpy/Images/NameSpace.png and /dev/null differ diff --git a/ILSpy/Images/Namespace.svg b/ILSpy/Images/Namespace.svg new file mode 100644 index 000000000..772b9152c --- /dev/null +++ b/ILSpy/Images/Namespace.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Namespace.xaml b/ILSpy/Images/Namespace.xaml new file mode 100644 index 000000000..9b3348860 --- /dev/null +++ b/ILSpy/Images/Namespace.xaml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ILSpy/Images/OK.png b/ILSpy/Images/OK.png deleted file mode 100644 index a7d7a96be..000000000 Binary files a/ILSpy/Images/OK.png and /dev/null differ diff --git a/ILSpy/Images/OK.svg b/ILSpy/Images/OK.svg new file mode 100644 index 000000000..3efeb5672 --- /dev/null +++ b/ILSpy/Images/OK.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/OK.xaml b/ILSpy/Images/OK.xaml new file mode 100644 index 000000000..c560e5bca --- /dev/null +++ b/ILSpy/Images/OK.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/Open.png b/ILSpy/Images/Open.png deleted file mode 100644 index 02ea25394..000000000 Binary files a/ILSpy/Images/Open.png and /dev/null differ diff --git a/ILSpy/Images/Open.svg b/ILSpy/Images/Open.svg new file mode 100644 index 000000000..8284b8ba4 --- /dev/null +++ b/ILSpy/Images/Open.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Open.xaml b/ILSpy/Images/Open.xaml new file mode 100644 index 000000000..7c2b6b50e --- /dev/null +++ b/ILSpy/Images/Open.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/Operator.png b/ILSpy/Images/Operator.png deleted file mode 100644 index 97f0e95bd..000000000 Binary files a/ILSpy/Images/Operator.png and /dev/null differ diff --git a/ILSpy/Images/Operator.svg b/ILSpy/Images/Operator.svg new file mode 100644 index 000000000..806381c45 --- /dev/null +++ b/ILSpy/Images/Operator.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Operator.xaml b/ILSpy/Images/Operator.xaml new file mode 100644 index 000000000..45da6efb0 --- /dev/null +++ b/ILSpy/Images/Operator.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ILSpy/Images/OverlayCompilerControlled.png b/ILSpy/Images/OverlayCompilerControlled.png deleted file mode 100644 index f4adb5591..000000000 Binary files a/ILSpy/Images/OverlayCompilerControlled.png and /dev/null differ diff --git a/ILSpy/Images/OverlayCompilerControlled.svg b/ILSpy/Images/OverlayCompilerControlled.svg new file mode 100644 index 000000000..b2ef0e8e3 --- /dev/null +++ b/ILSpy/Images/OverlayCompilerControlled.svg @@ -0,0 +1,76 @@ + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/ILSpy/Images/OverlayCompilerControlled.xaml b/ILSpy/Images/OverlayCompilerControlled.xaml new file mode 100644 index 000000000..a49ec5a26 --- /dev/null +++ b/ILSpy/Images/OverlayCompilerControlled.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/OverlayInternal.png b/ILSpy/Images/OverlayInternal.png deleted file mode 100644 index a58776cea..000000000 Binary files a/ILSpy/Images/OverlayInternal.png and /dev/null differ diff --git a/ILSpy/Images/OverlayInternal.svg b/ILSpy/Images/OverlayInternal.svg new file mode 100644 index 000000000..354024b95 --- /dev/null +++ b/ILSpy/Images/OverlayInternal.svg @@ -0,0 +1,76 @@ + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/ILSpy/Images/OverlayInternal.xaml b/ILSpy/Images/OverlayInternal.xaml new file mode 100644 index 000000000..ae2a37ff5 Binary files /dev/null and b/ILSpy/Images/OverlayInternal.xaml differ diff --git a/ILSpy/Images/OverlayPrivate.png b/ILSpy/Images/OverlayPrivate.png deleted file mode 100644 index e33ec404e..000000000 Binary files a/ILSpy/Images/OverlayPrivate.png and /dev/null differ diff --git a/ILSpy/Images/OverlayPrivate.svg b/ILSpy/Images/OverlayPrivate.svg new file mode 100644 index 000000000..1d2c52d96 --- /dev/null +++ b/ILSpy/Images/OverlayPrivate.svg @@ -0,0 +1,80 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/ILSpy/Images/OverlayPrivate.xaml b/ILSpy/Images/OverlayPrivate.xaml new file mode 100644 index 000000000..c05c10fde Binary files /dev/null and b/ILSpy/Images/OverlayPrivate.xaml differ diff --git a/ILSpy/Images/OverlayPrivateProtected.png b/ILSpy/Images/OverlayPrivateProtected.png deleted file mode 100644 index 497753285..000000000 Binary files a/ILSpy/Images/OverlayPrivateProtected.png and /dev/null differ diff --git a/ILSpy/Images/OverlayPrivateProtected.svg b/ILSpy/Images/OverlayPrivateProtected.svg new file mode 100644 index 000000000..cdd7ca98b --- /dev/null +++ b/ILSpy/Images/OverlayPrivateProtected.svg @@ -0,0 +1,84 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/ILSpy/Images/OverlayPrivateProtected.xaml b/ILSpy/Images/OverlayPrivateProtected.xaml new file mode 100644 index 000000000..ee0b0c827 Binary files /dev/null and b/ILSpy/Images/OverlayPrivateProtected.xaml differ diff --git a/ILSpy/Images/OverlayProtected.png b/ILSpy/Images/OverlayProtected.png deleted file mode 100644 index da9033d88..000000000 Binary files a/ILSpy/Images/OverlayProtected.png and /dev/null differ diff --git a/ILSpy/Images/OverlayProtected.svg b/ILSpy/Images/OverlayProtected.svg new file mode 100644 index 000000000..931b970ee --- /dev/null +++ b/ILSpy/Images/OverlayProtected.svg @@ -0,0 +1,72 @@ + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/ILSpy/Images/OverlayProtected.xaml b/ILSpy/Images/OverlayProtected.xaml new file mode 100644 index 000000000..399719a34 Binary files /dev/null and b/ILSpy/Images/OverlayProtected.xaml differ diff --git a/ILSpy/Images/OverlayProtectedInternal.png b/ILSpy/Images/OverlayProtectedInternal.png deleted file mode 100644 index 8f655d30d..000000000 Binary files a/ILSpy/Images/OverlayProtectedInternal.png and /dev/null differ diff --git a/ILSpy/Images/OverlayProtectedInternal.svg b/ILSpy/Images/OverlayProtectedInternal.svg new file mode 100644 index 000000000..17bb1986f --- /dev/null +++ b/ILSpy/Images/OverlayProtectedInternal.svg @@ -0,0 +1,79 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/ILSpy/Images/OverlayProtectedInternal.xaml b/ILSpy/Images/OverlayProtectedInternal.xaml new file mode 100644 index 000000000..b5d2a81d4 Binary files /dev/null and b/ILSpy/Images/OverlayProtectedInternal.xaml differ diff --git a/ILSpy/Images/OverlayStatic.png b/ILSpy/Images/OverlayStatic.png deleted file mode 100644 index 1a0e5e9d4..000000000 Binary files a/ILSpy/Images/OverlayStatic.png and /dev/null differ diff --git a/ILSpy/Images/OverlayStatic.svg b/ILSpy/Images/OverlayStatic.svg new file mode 100644 index 000000000..1151193b2 --- /dev/null +++ b/ILSpy/Images/OverlayStatic.svg @@ -0,0 +1,73 @@ + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/ILSpy/Images/OverlayStatic.xaml b/ILSpy/Images/OverlayStatic.xaml new file mode 100644 index 000000000..fee145f39 Binary files /dev/null and b/ILSpy/Images/OverlayStatic.xaml differ diff --git a/ILSpy/Images/PInvokeMethod.png b/ILSpy/Images/PInvokeMethod.png deleted file mode 100644 index caa558e48..000000000 Binary files a/ILSpy/Images/PInvokeMethod.png and /dev/null differ diff --git a/ILSpy/Images/PInvokeMethod.svg b/ILSpy/Images/PInvokeMethod.svg new file mode 100644 index 000000000..4db51d198 --- /dev/null +++ b/ILSpy/Images/PInvokeMethod.svg @@ -0,0 +1,79 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/ILSpy/Images/PInvokeMethod.xaml b/ILSpy/Images/PInvokeMethod.xaml new file mode 100644 index 000000000..12c70e437 --- /dev/null +++ b/ILSpy/Images/PInvokeMethod.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/PrivateInternal.png b/ILSpy/Images/PrivateInternal.png deleted file mode 100644 index 16568f805..000000000 Binary files a/ILSpy/Images/PrivateInternal.png and /dev/null differ diff --git a/ILSpy/Images/Property.png b/ILSpy/Images/Property.png deleted file mode 100644 index 2160695ad..000000000 Binary files a/ILSpy/Images/Property.png and /dev/null differ diff --git a/ILSpy/Images/Property.svg b/ILSpy/Images/Property.svg new file mode 100644 index 000000000..6b5b18a08 --- /dev/null +++ b/ILSpy/Images/Property.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Property.xaml b/ILSpy/Images/Property.xaml new file mode 100644 index 000000000..a7ced2d70 --- /dev/null +++ b/ILSpy/Images/Property.xaml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ILSpy/Images/README.md b/ILSpy/Images/README.md new file mode 100644 index 000000000..0bf5fadf4 --- /dev/null +++ b/ILSpy/Images/README.md @@ -0,0 +1,70 @@ +Icons used in ILSpy: +-------------------- + +| | SVG | XAML | Origin | Notes | +|---------------------------|-----|------|---------------------------------------------------------------------------------|---------| +| Assembly | x | x | VS 2017 Icon Pack (Reference) | | +| AssemblyList | x | x | VS 2017 Icon Pack (AddReference) | | +| AssemblyListGAC | x | x | based on VS 2017 Icon Pack (AddReference) + "GAC" text | | +| AssemblyWarning | x | x | VS 2017 Icon Pack (ReferenceWarning) | | +| Back | x | x | VS 2017 Icon Pack (Backward) | | +| Class | x | x | VS 2017 Icon Pack (Class) | | +| Close | x | x | VS 2017 Icon Pack (Clear) | | +| CollapseAll | x | x | VS 2017 Icon Pack (CollapseAll) | | +| Constructor | x | x | based on VS 2017 Icon Pack (Method) using a different colour | | +| Copy | x | x | VS 2017 Icon Pack (Copy) | | +| Delegate | x | x | VS 2017 Icon Pack (Delegate) | | +| Delete | x | x | | | +| Enum | x | x | VS 2017 Icon Pack (Enumerator) | | +| EnumValue | x | x | VS 2017 Icon Pack (EnumItem) | | +| Event | x | x | VS 2017 Icon Pack (Event) | | +| ExtensionMethod | x | x | VS 2017 Icon Pack (ExtensionMethod) | | +| Field | x | x | VS 2017 Icon Pack (Field) | | +| FieldReadOnly | x | x | VS 2017 Icon Pack (Field) with different color | | +| FindAssembly | x | x | based on VS 2017 Icon Pack (Reference + Search) with transparency modifications | | +| Folder.Closed | x | x | VS 2017 Icon Pack (Folder) | | +| Folder.Open | x | x | VS 2017 Icon Pack (FolderOpen) | | +| Forward | x | x | VS 2017 Icon Pack (Forward) | | +| Indexer | x | x | VS 2017 Icon Pack (Indexer) | | +| Interface | x | x | VS 2017 Icon Pack (Interface) | | +| Library | x | x | VS 2017 Icon Pack (Library) | | +| Literal | x | x | VS 2017 Icon Pack (Literal) | | +| Method | x | x | VS 2017 Icon Pack (Method) | | +| Namespace | x | x | VS 2017 Icon Pack (Namespace) | | +| OK | x | x | VS 2017 Icon Pack (StatusOK) | | +| Open | x | x | VS 2017 Icon Pack (Open) | | +| Operator | x | x | VS 2017 Icon Pack (Operator) | | +| OverlayCompilerControlled | x | x | based on VS 2017 Icon Pack (StatusBlocked) | | +| OverlayInternal | x | x | based on VS 2017 Icon Pack (Friend) | | +| OverlayPrivate | x | x | extracted from VS 2017 Icon Pack (ActionPrivate) | | +| OverlayPrivateProtected | x | x | combined OverlayPrivate and OverlayProtected | | +| OverlayProtected | x | x | extracted from VS 2017 Icon Pack (ActionProtected) | | +| OverlayProtectedInternal | x | x | combined OverlayProtected and OverlayInternal | | +| OverlayStatic | x | x | custom | | +| PInvokeMethod | x | x | based on VS 2017 Icon Pack (ExtensionMethod) with rotated arrow | | +| Property | x | x | VS 2017 Icon Pack (Property) | | +| ReferenceFolder | x | x | combined VS 2017 Icon Pack (Reference) two times | | +| Refresh | x | x | VS 2017 Icon Pack (Refresh) | | +| Resource | x | x | | | +| ResourceImage | x | x | | | +| ResourceResourcesFile | x | x | | | +| ResourceXml | x | x | | | +| ResourceXsd | x | x | combined VS 2017 Icon Pack (XMLSchema) with the "file symbol in ResourceXslt | | +| ResourceXsl | x | x | VS 2017 Icon Pack (XMLTransformation) | | +| ResourceXslt | x | x | VS 2017 Icon Pack (XSLTTemplate) | | +| Save | x | x | VS 2017 Icon Pack (Save) | | +| Search | x | x | VS 2017 Icon Pack (Search) | | +| SearchMsdn | x | x | based on VS 2017 Icon Pack (Search) + Microsoft Logo | | +| ShowAll | x | x | combined PublicOnly, OverlayPrivate, OverlayProtected, OverlayInternal | | +| ShowPrivateInternal | x | x | combined OverlayPrivate and OverlayInternal | | +| ShowPublicOnly | x | x | | | +| Sort | x | x | VS 2017 Icon Pack (SortAscending) | | +| Struct | x | x | VS 2017 Icon Pack (Structure) | | +| SubTypes | x | x | | | +| SuperTypes | x | x | | | +| ViewCode | x | x | | | +| VirtualMethod | x | x | combined VS 2017 Icon Pack (Method) two times | | +| Warning | x | x | VS 2017 Icon Pack (StatusWarning) | | + +Note: All XAML icons from VS 2017 Icon Pack are modified to not include a `Viewbox` XAML root element. We always use a `Drawing`-derived root element. +Note: When changing an icon, start with SVG and use https://github.com/BerndK/SvgToXaml to generate the XAML. The result is much better XAML than what Inkscape produces. \ No newline at end of file diff --git a/ILSpy/Images/ReferenceFolder.Closed.png b/ILSpy/Images/ReferenceFolder.Closed.png deleted file mode 100644 index e99252016..000000000 Binary files a/ILSpy/Images/ReferenceFolder.Closed.png and /dev/null differ diff --git a/ILSpy/Images/ReferenceFolder.Open.png b/ILSpy/Images/ReferenceFolder.Open.png deleted file mode 100644 index c986addc0..000000000 Binary files a/ILSpy/Images/ReferenceFolder.Open.png and /dev/null differ diff --git a/ILSpy/Images/ReferenceFolder.svg b/ILSpy/Images/ReferenceFolder.svg new file mode 100644 index 000000000..469268e6c --- /dev/null +++ b/ILSpy/Images/ReferenceFolder.svg @@ -0,0 +1,90 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/ILSpy/Images/ReferenceFolder.xaml b/ILSpy/Images/ReferenceFolder.xaml new file mode 100644 index 000000000..de230e5ad Binary files /dev/null and b/ILSpy/Images/ReferenceFolder.xaml differ diff --git a/ILSpy/Images/Refresh.png b/ILSpy/Images/Refresh.png deleted file mode 100644 index 6d68b75b8..000000000 Binary files a/ILSpy/Images/Refresh.png and /dev/null differ diff --git a/ILSpy/Images/Refresh.svg b/ILSpy/Images/Refresh.svg new file mode 100644 index 000000000..a6f09ee5f --- /dev/null +++ b/ILSpy/Images/Refresh.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Refresh.xaml b/ILSpy/Images/Refresh.xaml new file mode 100644 index 000000000..e6e13697a --- /dev/null +++ b/ILSpy/Images/Refresh.xaml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/Resource.png b/ILSpy/Images/Resource.png deleted file mode 100644 index ed841a02a..000000000 Binary files a/ILSpy/Images/Resource.png and /dev/null differ diff --git a/ILSpy/Images/Resource.svg b/ILSpy/Images/Resource.svg new file mode 100644 index 000000000..7b36178ab --- /dev/null +++ b/ILSpy/Images/Resource.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Resource.xaml b/ILSpy/Images/Resource.xaml new file mode 100644 index 000000000..4e973ba91 --- /dev/null +++ b/ILSpy/Images/Resource.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ILSpy/Images/ResourceImage.png b/ILSpy/Images/ResourceImage.png deleted file mode 100644 index c485c2016..000000000 Binary files a/ILSpy/Images/ResourceImage.png and /dev/null differ diff --git a/ILSpy/Images/ResourceImage.svg b/ILSpy/Images/ResourceImage.svg new file mode 100644 index 000000000..bfbc17d70 --- /dev/null +++ b/ILSpy/Images/ResourceImage.svg @@ -0,0 +1 @@ +Image_16x \ No newline at end of file diff --git a/ILSpy/Images/ResourceImage.xaml b/ILSpy/Images/ResourceImage.xaml new file mode 100644 index 000000000..47f992d43 --- /dev/null +++ b/ILSpy/Images/ResourceImage.xaml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/ILSpy/Images/ResourceResourcesFile.png b/ILSpy/Images/ResourceResourcesFile.png deleted file mode 100644 index 811940b47..000000000 Binary files a/ILSpy/Images/ResourceResourcesFile.png and /dev/null differ diff --git a/ILSpy/Images/ResourceResourcesFile.svg b/ILSpy/Images/ResourceResourcesFile.svg new file mode 100644 index 000000000..7f463d7ef --- /dev/null +++ b/ILSpy/Images/ResourceResourcesFile.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/ResourceResourcesFile.xaml b/ILSpy/Images/ResourceResourcesFile.xaml new file mode 100644 index 000000000..22555471b --- /dev/null +++ b/ILSpy/Images/ResourceResourcesFile.xaml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ILSpy/Images/ResourceXml.png b/ILSpy/Images/ResourceXml.png deleted file mode 100644 index c9af2e1b3..000000000 Binary files a/ILSpy/Images/ResourceXml.png and /dev/null differ diff --git a/ILSpy/Images/ResourceXml.svg b/ILSpy/Images/ResourceXml.svg new file mode 100644 index 000000000..c7878bf42 --- /dev/null +++ b/ILSpy/Images/ResourceXml.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/ResourceXml.xaml b/ILSpy/Images/ResourceXml.xaml new file mode 100644 index 000000000..b20527426 --- /dev/null +++ b/ILSpy/Images/ResourceXml.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ILSpy/Images/ResourceXsd.png b/ILSpy/Images/ResourceXsd.png deleted file mode 100644 index 8fd2079f4..000000000 Binary files a/ILSpy/Images/ResourceXsd.png and /dev/null differ diff --git a/ILSpy/Images/ResourceXsd.svg b/ILSpy/Images/ResourceXsd.svg new file mode 100644 index 000000000..51d6cadac --- /dev/null +++ b/ILSpy/Images/ResourceXsd.svg @@ -0,0 +1,93 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/ILSpy/Images/ResourceXsd.xaml b/ILSpy/Images/ResourceXsd.xaml new file mode 100644 index 000000000..094c64210 --- /dev/null +++ b/ILSpy/Images/ResourceXsd.xaml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/ResourceXsl.png b/ILSpy/Images/ResourceXsl.png deleted file mode 100644 index e5beb6b51..000000000 Binary files a/ILSpy/Images/ResourceXsl.png and /dev/null differ diff --git a/ILSpy/Images/ResourceXsl.svg b/ILSpy/Images/ResourceXsl.svg new file mode 100644 index 000000000..1f67bef05 --- /dev/null +++ b/ILSpy/Images/ResourceXsl.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/ResourceXsl.xaml b/ILSpy/Images/ResourceXsl.xaml new file mode 100644 index 000000000..c0973b2d3 --- /dev/null +++ b/ILSpy/Images/ResourceXsl.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/ResourceXslt.png b/ILSpy/Images/ResourceXslt.png deleted file mode 100644 index 107c9f2a6..000000000 Binary files a/ILSpy/Images/ResourceXslt.png and /dev/null differ diff --git a/ILSpy/Images/ResourceXslt.svg b/ILSpy/Images/ResourceXslt.svg new file mode 100644 index 000000000..b53ffb0ca --- /dev/null +++ b/ILSpy/Images/ResourceXslt.svg @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/ILSpy/Images/ResourceXslt.xaml b/ILSpy/Images/ResourceXslt.xaml new file mode 100644 index 000000000..91a0b26a4 --- /dev/null +++ b/ILSpy/Images/ResourceXslt.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ILSpy/Images/Save.svg b/ILSpy/Images/Save.svg new file mode 100644 index 000000000..e2a1dec56 --- /dev/null +++ b/ILSpy/Images/Save.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Save.xaml b/ILSpy/Images/Save.xaml new file mode 100644 index 000000000..2a74dc9d4 --- /dev/null +++ b/ILSpy/Images/Save.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/SaveFile.png b/ILSpy/Images/SaveFile.png deleted file mode 100644 index 61784784f..000000000 Binary files a/ILSpy/Images/SaveFile.png and /dev/null differ diff --git a/ILSpy/Images/Search.png b/ILSpy/Images/Search.png deleted file mode 100644 index 7a5ae62e3..000000000 Binary files a/ILSpy/Images/Search.png and /dev/null differ diff --git a/ILSpy/Images/Search.svg b/ILSpy/Images/Search.svg new file mode 100644 index 000000000..1b80bf68c --- /dev/null +++ b/ILSpy/Images/Search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Search.xaml b/ILSpy/Images/Search.xaml new file mode 100644 index 000000000..f1bb3be67 --- /dev/null +++ b/ILSpy/Images/Search.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/SearchMsdn.png b/ILSpy/Images/SearchMsdn.png deleted file mode 100644 index 42cefecdf..000000000 Binary files a/ILSpy/Images/SearchMsdn.png and /dev/null differ diff --git a/ILSpy/Images/SearchMsdn.svg b/ILSpy/Images/SearchMsdn.svg new file mode 100644 index 000000000..3ab277f7e --- /dev/null +++ b/ILSpy/Images/SearchMsdn.svg @@ -0,0 +1,89 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/ILSpy/Images/SearchMsdn.xaml b/ILSpy/Images/SearchMsdn.xaml new file mode 100644 index 000000000..c568e1660 --- /dev/null +++ b/ILSpy/Images/SearchMsdn.xaml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/ShowAll.png b/ILSpy/Images/ShowAll.png deleted file mode 100644 index ab9151c87..000000000 Binary files a/ILSpy/Images/ShowAll.png and /dev/null differ diff --git a/ILSpy/Images/ShowAll.svg b/ILSpy/Images/ShowAll.svg new file mode 100644 index 000000000..1d7c4fc4c --- /dev/null +++ b/ILSpy/Images/ShowAll.svg @@ -0,0 +1,142 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ILSpy/Images/ShowAll.xaml b/ILSpy/Images/ShowAll.xaml new file mode 100644 index 000000000..450383788 Binary files /dev/null and b/ILSpy/Images/ShowAll.xaml differ diff --git a/ILSpy/Images/ShowPrivateInternal.svg b/ILSpy/Images/ShowPrivateInternal.svg new file mode 100644 index 000000000..e43bd4360 --- /dev/null +++ b/ILSpy/Images/ShowPrivateInternal.svg @@ -0,0 +1,101 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/ILSpy/Images/ShowPrivateInternal.xaml b/ILSpy/Images/ShowPrivateInternal.xaml new file mode 100644 index 000000000..a7c859d1c Binary files /dev/null and b/ILSpy/Images/ShowPrivateInternal.xaml differ diff --git a/ILSpy/Images/ShowPublicOnly.svg b/ILSpy/Images/ShowPublicOnly.svg new file mode 100644 index 000000000..24baa490d --- /dev/null +++ b/ILSpy/Images/ShowPublicOnly.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/ShowPublicOnly.xaml b/ILSpy/Images/ShowPublicOnly.xaml new file mode 100644 index 000000000..e13198fbc --- /dev/null +++ b/ILSpy/Images/ShowPublicOnly.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/Sort.png b/ILSpy/Images/Sort.png deleted file mode 100644 index b508e9a49..000000000 Binary files a/ILSpy/Images/Sort.png and /dev/null differ diff --git a/ILSpy/Images/Sort.svg b/ILSpy/Images/Sort.svg new file mode 100644 index 000000000..75830ceb6 --- /dev/null +++ b/ILSpy/Images/Sort.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Sort.xaml b/ILSpy/Images/Sort.xaml new file mode 100644 index 000000000..7c8ebee2e --- /dev/null +++ b/ILSpy/Images/Sort.xaml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/StaticClass.png b/ILSpy/Images/StaticClass.png deleted file mode 100644 index 4f200b2a0..000000000 Binary files a/ILSpy/Images/StaticClass.png and /dev/null differ diff --git a/ILSpy/Images/Struct.png b/ILSpy/Images/Struct.png deleted file mode 100644 index 745352b9b..000000000 Binary files a/ILSpy/Images/Struct.png and /dev/null differ diff --git a/ILSpy/Images/Struct.svg b/ILSpy/Images/Struct.svg new file mode 100644 index 000000000..811f389f8 --- /dev/null +++ b/ILSpy/Images/Struct.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Struct.xaml b/ILSpy/Images/Struct.xaml new file mode 100644 index 000000000..b5142701b --- /dev/null +++ b/ILSpy/Images/Struct.xaml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/SubTypes.png b/ILSpy/Images/SubTypes.png deleted file mode 100644 index 6d4a55f89..000000000 Binary files a/ILSpy/Images/SubTypes.png and /dev/null differ diff --git a/ILSpy/Images/SubTypes.svg b/ILSpy/Images/SubTypes.svg new file mode 100644 index 000000000..fbe0b6840 --- /dev/null +++ b/ILSpy/Images/SubTypes.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/SubTypes.xaml b/ILSpy/Images/SubTypes.xaml new file mode 100644 index 000000000..f04b0a283 --- /dev/null +++ b/ILSpy/Images/SubTypes.xaml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/ILSpy/Images/SuperTypes.png b/ILSpy/Images/SuperTypes.png deleted file mode 100644 index 0b3825860..000000000 Binary files a/ILSpy/Images/SuperTypes.png and /dev/null differ diff --git a/ILSpy/Images/SuperTypes.svg b/ILSpy/Images/SuperTypes.svg new file mode 100644 index 000000000..201af86b7 --- /dev/null +++ b/ILSpy/Images/SuperTypes.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/SuperTypes.xaml b/ILSpy/Images/SuperTypes.xaml new file mode 100644 index 000000000..9563b07e1 --- /dev/null +++ b/ILSpy/Images/SuperTypes.xaml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/ILSpy/Images/TypeIcon.cs b/ILSpy/Images/TypeIcon.cs index a3e6b4b91..ec4b8fd58 100644 --- a/ILSpy/Images/TypeIcon.cs +++ b/ILSpy/Images/TypeIcon.cs @@ -25,7 +25,6 @@ namespace ICSharpCode.ILSpy Enum, Struct, Interface, - Delegate, - StaticClass + Delegate } } diff --git a/ILSpy/Images/ViewCode.png b/ILSpy/Images/ViewCode.png deleted file mode 100644 index d718d7863..000000000 Binary files a/ILSpy/Images/ViewCode.png and /dev/null differ diff --git a/ILSpy/Images/ViewCode.svg b/ILSpy/Images/ViewCode.svg new file mode 100644 index 000000000..7c0f3e087 --- /dev/null +++ b/ILSpy/Images/ViewCode.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/ViewCode.xaml b/ILSpy/Images/ViewCode.xaml new file mode 100644 index 000000000..e999a54fe --- /dev/null +++ b/ILSpy/Images/ViewCode.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/VirtualMethod.png b/ILSpy/Images/VirtualMethod.png deleted file mode 100644 index 61ca12d84..000000000 Binary files a/ILSpy/Images/VirtualMethod.png and /dev/null differ diff --git a/ILSpy/Images/VirtualMethod.svg b/ILSpy/Images/VirtualMethod.svg new file mode 100644 index 000000000..dfb0aeba5 --- /dev/null +++ b/ILSpy/Images/VirtualMethod.svg @@ -0,0 +1,93 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/ILSpy/Images/VirtualMethod.xaml b/ILSpy/Images/VirtualMethod.xaml new file mode 100644 index 000000000..b04ec8314 --- /dev/null +++ b/ILSpy/Images/VirtualMethod.xaml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Images/Warning.png b/ILSpy/Images/Warning.png deleted file mode 100644 index 721ba1ef8..000000000 Binary files a/ILSpy/Images/Warning.png and /dev/null differ diff --git a/ILSpy/Images/Warning.svg b/ILSpy/Images/Warning.svg new file mode 100644 index 000000000..190b9e3e0 --- /dev/null +++ b/ILSpy/Images/Warning.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ILSpy/Images/Warning.xaml b/ILSpy/Images/Warning.xaml new file mode 100644 index 000000000..e9e723ccc --- /dev/null +++ b/ILSpy/Images/Warning.xaml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ILSpy/Languages/CSharpLanguage.cs b/ILSpy/Languages/CSharpLanguage.cs index 087aaec61..daf6bc713 100644 --- a/ILSpy/Languages/CSharpLanguage.cs +++ b/ILSpy/Languages/CSharpLanguage.cs @@ -325,7 +325,7 @@ namespace ICSharpCode.ILSpy new Image { Width = 32, Height = 32, - Source = Images.LoadImage(this, "Images/Warning.png") + Source = Images.Load(this, "Images/Warning") }, new TextBlock { Margin = new Thickness(5, 0, 0, 0), @@ -432,6 +432,7 @@ namespace ICSharpCode.ILSpy this.options = options; base.Settings = options.DecompilerSettings; base.AssemblyResolver = assembly.GetAssemblyResolver(); + base.DebugInfoProvider = assembly.GetDebugInfoOrNull(); } protected override IEnumerable> WriteResourceToFile(string fileName, string resourceName, Stream entryStream) @@ -439,7 +440,6 @@ namespace ICSharpCode.ILSpy foreach (var handler in App.ExportProvider.GetExportedValues()) { if (handler.CanHandle(fileName, options)) { entryStream.Position = 0; - fileName = Path.Combine(targetDirectory, fileName); fileName = handler.WriteResourceToFile(assembly, fileName, entryStream, options); return new[] { Tuple.Create(handler.EntryType, fileName) }; } diff --git a/ILSpy/LoadedAssembly.cs b/ILSpy/LoadedAssembly.cs index 064c0e8e8..af67109cd 100644 --- a/ILSpy/LoadedAssembly.cs +++ b/ILSpy/LoadedAssembly.cs @@ -53,7 +53,7 @@ namespace ICSharpCode.ILSpy { this.assemblyList = assemblyList ?? throw new ArgumentNullException(nameof(assemblyList)); this.fileName = fileName ?? throw new ArgumentNullException(nameof(fileName)); - + this.assemblyTask = Task.Factory.StartNew(LoadAssembly, stream); // requires that this.fileName is set this.shortName = Path.GetFileNameWithoutExtension(fileName); } @@ -145,20 +145,23 @@ namespace ICSharpCode.ILSpy PEFile LoadAssembly(object state) { - var stream = state as Stream; - PEFile module; + MetadataReaderOptions options; + if (DecompilerSettingsPanel.CurrentDecompilerSettings.ApplyWindowsRuntimeProjections) { + options = MetadataReaderOptions.ApplyWindowsRuntimeProjections; + } else { + options = MetadataReaderOptions.None; + } + PEFile module; // runs on background thread - if (stream != null) - { + if (state is Stream stream) { // Read the module from a precrafted stream - module = new PEFile(fileName, stream, metadataOptions: DecompilerSettingsPanel.CurrentDecompilerSettings.ApplyWindowsRuntimeProjections ? MetadataReaderOptions.ApplyWindowsRuntimeProjections : MetadataReaderOptions.None); - } - else - { + module = new PEFile(fileName, stream, metadataOptions: options); + } else { // Read the module from disk (by default) - module = new PEFile(fileName, new FileStream(fileName, FileMode.Open, FileAccess.Read), PEStreamOptions.PrefetchEntireImage, - metadataOptions: DecompilerSettingsPanel.CurrentDecompilerSettings.ApplyWindowsRuntimeProjections ? MetadataReaderOptions.ApplyWindowsRuntimeProjections : MetadataReaderOptions.None); + stream = new FileStream(fileName, FileMode.Open, FileAccess.Read); + module = new PEFile(fileName, stream, PEStreamOptions.PrefetchEntireImage, + metadataOptions: options); } if (DecompilerSettingsPanel.CurrentDecompilerSettings.UseDebugSymbols) { @@ -175,7 +178,7 @@ namespace ICSharpCode.ILSpy } return module; } - + void LoadSymbols(PEFile module) { try { @@ -242,17 +245,17 @@ namespace ICSharpCode.ILSpy [ThreadStatic] static int assemblyLoadDisableCount; - + public static IDisposable DisableAssemblyLoad() { assemblyLoadDisableCount++; return new DecrementAssemblyLoadDisableCount(); } - + sealed class DecrementAssemblyLoadDisableCount : IDisposable { bool disposed; - + public void Dispose() { if (!disposed) { @@ -263,16 +266,16 @@ namespace ICSharpCode.ILSpy } } } - + sealed class MyAssemblyResolver : IAssemblyResolver { readonly LoadedAssembly parent; - + public MyAssemblyResolver(LoadedAssembly parent) { this.parent = parent; } - + public PEFile Resolve(Decompiler.Metadata.IAssemblyReference reference) { return parent.LookupReferencedAssembly(reference)?.GetPEFileOrNull(); @@ -283,7 +286,7 @@ namespace ICSharpCode.ILSpy return parent.LookupReferencedModule(mainModule, moduleName)?.GetPEFileOrNull(); } } - + public IAssemblyResolver GetAssemblyResolver() { return new MyAssemblyResolver(this); @@ -298,7 +301,7 @@ namespace ICSharpCode.ILSpy return null; return debugInfoProvider; } - + public LoadedAssembly LookupReferencedAssembly(Decompiler.Metadata.IAssemblyReference reference) { if (reference == null) @@ -371,7 +374,7 @@ namespace ICSharpCode.ILSpy } loadingAssemblies.Add(file, asm); } - App.Current.Dispatcher.BeginInvoke((Action)delegate() { + App.Current.Dispatcher.BeginInvoke((Action)delegate () { lock (assemblyList.assemblies) { assemblyList.assemblies.Add(asm); } @@ -437,7 +440,7 @@ namespace ICSharpCode.ILSpy { return this.assemblyTask.ContinueWith(onAssemblyLoaded, default(CancellationToken), TaskContinuationOptions.RunContinuationsAsynchronously, taskScheduler); } - + /// /// Wait until the assembly is loaded. /// Throws an AggregateException when loading the assembly fails. diff --git a/ILSpy/MainWindow.xaml b/ILSpy/MainWindow.xaml index a83b6d799..c8846031e 100644 --- a/ILSpy/MainWindow.xaml +++ b/ILSpy/MainWindow.xaml @@ -53,16 +53,9 @@ - - - - - - - - - - + + + @@ -85,11 +78,14 @@ - - + + - - + + + + + history = new NavigationHistory(); ILSpySettings spySettingsForMainWindow_Loaded; internal SessionSettings sessionSettings; - + internal AssemblyListManager assemblyListManager; AssemblyList assemblyList; AssemblyListTreeNode assemblyListTreeNode; - + readonly DecompilerTextView decompilerTextView; - + static MainWindow instance; - + public static MainWindow Instance { get { return instance; } } - + public SessionSettings SessionSettings { get { return sessionSettings; } } - + public MainWindow() { instance = this; @@ -80,28 +81,28 @@ namespace ICSharpCode.ILSpy this.spySettingsForMainWindow_Loaded = spySettings; this.sessionSettings = new SessionSettings(spySettings); this.assemblyListManager = new AssemblyListManager(spySettings); - + this.Icon = new BitmapImage(new Uri("pack://application:,,,/ILSpy;component/images/ILSpy.ico")); - + this.DataContext = sessionSettings; - + InitializeComponent(); decompilerTextView = App.ExportProvider.GetExportedValue(); mainPane.Content = decompilerTextView; - + if (sessionSettings.SplitterPosition > 0 && sessionSettings.SplitterPosition < 1) { leftColumn.Width = new GridLength(sessionSettings.SplitterPosition, GridUnitType.Star); rightColumn.Width = new GridLength(1 - sessionSettings.SplitterPosition, GridUnitType.Star); } sessionSettings.FilterSettings.PropertyChanged += filterSettings_PropertyChanged; - + InitMainMenu(); InitToolbar(); ContextMenuProvider.Add(treeView, decompilerTextView); - + this.Loaded += MainWindow_Loaded; } - + void SetWindowBounds(Rect bounds) { this.Left = bounds.Left; @@ -109,9 +110,9 @@ namespace ICSharpCode.ILSpy this.Width = bounds.Width; this.Height = bounds.Height; } - + #region Toolbar extensibility - + void InitToolbar() { int navigationPos = 0; @@ -134,26 +135,30 @@ namespace ICSharpCode.ILSpy } } } - + } - + Button MakeToolbarItem(Lazy command) { + object image = Images.Load(command.Value, command.Metadata.ToolbarIcon); + if (!(image is Viewbox)) { + image = new Image { + Width = 16, + Height = 16, + Source = (ImageSource)image + }; + } return new Button { Command = CommandWrapper.Unwrap(command.Value), - ToolTip =Properties.Resources.ResourceManager.GetString( command.Metadata.ToolTip), + ToolTip = Properties.Resources.ResourceManager.GetString(command.Metadata.ToolTip), Tag = command.Metadata.Tag, - Content = new Image { - Width = 16, - Height = 16, - Source = Images.LoadImage(command.Value, command.Metadata.ToolbarIcon) - } + Content = image }; } #endregion - + #region Main Menu extensibility - + void InitMainMenu() { var mainMenuCommands = App.ExportProvider.GetExports("MainMenuCommand"); @@ -173,11 +178,15 @@ namespace ICSharpCode.ILSpy if (!string.IsNullOrEmpty(GetResourceString(entry.Metadata.Header))) menuItem.Header = GetResourceString(entry.Metadata.Header); if (!string.IsNullOrEmpty(entry.Metadata.MenuIcon)) { - menuItem.Icon = new Image { - Width = 16, - Height = 16, - Source = Images.LoadImage(entry.Value, entry.Metadata.MenuIcon) - }; + object image = Images.Load(entry.Value, entry.Metadata.MenuIcon); + if (!(image is Viewbox)) { + image = new Image { + Width = 16, + Height = 16, + Source = (ImageSource)image + }; + } + menuItem.Icon = image; } menuItem.IsEnabled = entry.Metadata.IsEnabled; @@ -190,8 +199,8 @@ namespace ICSharpCode.ILSpy internal static string GetResourceString(string key) { - var str = !string.IsNullOrEmpty(key)? Properties.Resources.ResourceManager.GetString(key):null; - return string.IsNullOrEmpty(key)|| string.IsNullOrEmpty(str) ? key : str; + var str = !string.IsNullOrEmpty(key) ? Properties.Resources.ResourceManager.GetString(key) : null; + return string.IsNullOrEmpty(key) || string.IsNullOrEmpty(str) ? key : str; } #endregion @@ -217,16 +226,18 @@ namespace ICSharpCode.ILSpy SetWindowBounds(sessionSettings.WindowBounds); else SetWindowBounds(SessionSettings.DefaultWindowBounds); - + this.WindowState = sessionSettings.WindowState; } - + unsafe IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { if (msg == NativeMethods.WM_COPYDATA) { CopyDataStruct* copyData = (CopyDataStruct*)lParam; string data = new string((char*)copyData->Buffer, 0, copyData->Size / sizeof(char)); if (data.StartsWith("ILSpy:\r\n", StringComparison.Ordinal)) { + if (handlingNugetPackageSelection) + return (IntPtr)1; data = data.Substring(8); List lines = new List(); using (StringReader r = new StringReader(data)) { @@ -247,17 +258,17 @@ namespace ICSharpCode.ILSpy return IntPtr.Zero; } #endregion - + public AssemblyList CurrentAssemblyList { get { return assemblyList; } } - + public event NotifyCollectionChangedEventHandler CurrentAssemblyListChanged; - + List commandLineLoadedAssemblies = new List(); List nugetPackagesToLoad = new List(); - + bool HandleCommandLineArguments(CommandLineArguments args) { int i = 0; @@ -270,12 +281,12 @@ namespace ICSharpCode.ILSpy i++; } } - LoadAssemblies(args.AssembliesToLoad, commandLineLoadedAssemblies, false); + LoadAssemblies(args.AssembliesToLoad, commandLineLoadedAssemblies, focusNode: false); if (args.Language != null) sessionSettings.FilterSettings.Language = Languages.GetLanguage(args.Language); return true; } - + /// /// Called on startup or when passed arguments via WndProc from a second instance. /// In the format case, spySettings is non-null; in the latter it is null. @@ -283,14 +294,15 @@ namespace ICSharpCode.ILSpy void HandleCommandLineArgumentsAfterShowList(CommandLineArguments args, ILSpySettings spySettings = null) { if (nugetPackagesToLoad.Count > 0) { - LoadAssemblies(nugetPackagesToLoad, commandLineLoadedAssemblies, focusNode: false); + var relevantPackages = nugetPackagesToLoad.ToArray(); nugetPackagesToLoad.Clear(); + // Show the nuget package open dialog after the command line/window message was processed. + Dispatcher.BeginInvoke(new Action(() => LoadAssemblies(relevantPackages, commandLineLoadedAssemblies, focusNode: false)), DispatcherPriority.Normal); } var relevantAssemblies = commandLineLoadedAssemblies.ToList(); commandLineLoadedAssemblies.Clear(); // clear references once we don't need them anymore NavigateOnLaunch(args.NavigateTo, sessionSettings.ActiveTreeViewPath, spySettings, relevantAssemblies); - if (args.Search != null) - { + if (args.Search != null) { SearchPane.Instance.SearchTerm = args.Search; SearchPane.Instance.Show(); } @@ -448,12 +460,12 @@ namespace ICSharpCode.ILSpy void OpenAssemblies(ILSpySettings spySettings) { HandleCommandLineArgumentsAfterShowList(App.CommandLineArguments, spySettings); - + AvalonEditTextOutput output = new AvalonEditTextOutput(); if (FormatExceptions(App.StartupExceptions.ToArray(), output)) decompilerTextView.ShowText(output); } - + bool FormatExceptions(App.ExceptionData[] exceptions, ITextOutput output) { var stringBuilder = new StringBuilder(); @@ -468,7 +480,7 @@ namespace ICSharpCode.ILSpy { if (exceptions.Length == 0) return false; bool first = true; - + foreach (var item in exceptions) { if (first) first = false; @@ -484,17 +496,17 @@ namespace ICSharpCode.ILSpy } else output.AppendLine(item.Exception.ToString()); } - + return true; } - + #region Update Check string updateAvailableDownloadUrl; - + public void ShowMessageIfUpdatesAvailableAsync(ILSpySettings spySettings, bool forceCheck = false) { // Don't check for updates if we're in an MSIX since they work differently - if(WindowsVersionHelper.HasPackageIdentity) { + if (WindowsVersionHelper.HasPackageIdentity) { return; } @@ -506,12 +518,12 @@ namespace ICSharpCode.ILSpy } result.ContinueWith(task => AdjustUpdateUIAfterCheck(task, forceCheck), TaskScheduler.FromCurrentSynchronizationContext()); } - + void updatePanelCloseButtonClick(object sender, RoutedEventArgs e) { updatePanel.Visibility = Visibility.Collapsed; } - + void downloadOrCheckUpdateButtonClick(object sender, RoutedEventArgs e) { if (updateAvailableDownloadUrl != null) { @@ -536,30 +548,29 @@ namespace ICSharpCode.ILSpy } } #endregion - + public void ShowAssemblyList(string name) { ILSpySettings settings = ILSpySettings.Load(); AssemblyList list = this.assemblyListManager.LoadList(settings, name); //Only load a new list when it is a different one - if (list.ListName != CurrentAssemblyList.ListName) - { + if (list.ListName != CurrentAssemblyList.ListName) { ShowAssemblyList(list); } } - + void ShowAssemblyList(AssemblyList assemblyList) { history.Clear(); this.assemblyList = assemblyList; - + assemblyList.assemblies.CollectionChanged += assemblyList_Assemblies_CollectionChanged; - + assemblyListTreeNode = new AssemblyListTreeNode(assemblyList); assemblyListTreeNode.FilterSettings = sessionSettings.FilterSettings.Clone(); assemblyListTreeNode.Select = SelectNode; treeView.Root = assemblyListTreeNode; - + if (assemblyList.ListName == AssemblyListManager.DefaultListName) #if DEBUG this.Title = $"ILSpy {RevisionClass.FullVersion}"; @@ -588,7 +599,7 @@ namespace ICSharpCode.ILSpy if (CurrentAssemblyListChanged != null) CurrentAssemblyListChanged(this, e); } - + void LoadInitialAssemblies() { // Called when loading an empty assembly list; so that @@ -606,7 +617,7 @@ namespace ICSharpCode.ILSpy foreach (System.Reflection.Assembly asm in initialAssemblies) assemblyList.OpenAssembly(asm.Location); } - + void filterSettings_PropertyChanged(object sender, PropertyChangedEventArgs e) { RefreshTreeViewFilter(); @@ -614,7 +625,7 @@ namespace ICSharpCode.ILSpy DecompileSelectedNodes(recordHistory: false); } } - + public void RefreshTreeViewFilter() { // filterSettings is mutable; but the ILSpyTreeNode filtering assumes that filter settings are immutable. @@ -623,11 +634,11 @@ namespace ICSharpCode.ILSpy if (assemblyListTreeNode != null) assemblyListTreeNode.FilterSettings = sessionSettings.FilterSettings.Clone(); } - + internal AssemblyListTreeNode AssemblyListTreeNode { get { return assemblyListTreeNode; } } - + #region Node Selection public void SelectNode(SharpTreeNode obj) @@ -653,7 +664,7 @@ namespace ICSharpCode.ILSpy treeView.SetSelectedNodes(nodes); } } - + /// /// Retrieves a node using the .ToString() representations of its ancestors. /// @@ -678,7 +689,7 @@ namespace ICSharpCode.ILSpy else return node; } - + /// /// Gets the .ToString() representation of the node's ancestors. /// @@ -694,7 +705,7 @@ namespace ICSharpCode.ILSpy path.Reverse(); return path.ToArray(); } - + public ILSpyTreeNode FindTreeNode(object reference) { switch (reference) { @@ -716,12 +727,12 @@ namespace ICSharpCode.ILSpy return null; } } - + public void JumpToReference(object reference) { JumpToReferenceAsync(reference).HandleExceptions(); } - + /// /// Jumps to the specified reference. /// @@ -792,7 +803,7 @@ namespace ICSharpCode.ILSpy { if (fileNames == null) throw new ArgumentNullException(nameof(fileNames)); - + if (focusNode) treeView.UnselectAll(); @@ -805,24 +816,29 @@ namespace ICSharpCode.ILSpy foreach (string file in fileNames) { switch (Path.GetExtension(file)) { case ".nupkg": - LoadedNugetPackage package = new LoadedNugetPackage(file); - var selectionDialog = new NugetPackageBrowserDialog(package); - selectionDialog.Owner = this; - if (selectionDialog.ShowDialog() != true) - break; - foreach (var entry in selectionDialog.SelectedItems) { - var nugetAsm = assemblyList.OpenAssembly("nupkg://" + file + ";" + entry.Name, entry.Stream, true); - if (nugetAsm != null) { - if (loadedAssemblies != null) - loadedAssemblies.Add(nugetAsm); - else { - var node = assemblyListTreeNode.FindAssemblyNode(nugetAsm); - if (node != null && focusNode) { - treeView.SelectedItems.Add(node); - lastNode = node; + this.handlingNugetPackageSelection = true; + try { + LoadedNugetPackage package = new LoadedNugetPackage(file); + var selectionDialog = new NugetPackageBrowserDialog(package); + selectionDialog.Owner = this; + if (selectionDialog.ShowDialog() != true) + break; + foreach (var entry in selectionDialog.SelectedItems) { + var nugetAsm = assemblyList.OpenAssembly("nupkg://" + file + ";" + entry.Name, entry.Stream, true); + if (nugetAsm != null) { + if (loadedAssemblies != null) + loadedAssemblies.Add(nugetAsm); + else { + var node = assemblyListTreeNode.FindAssemblyNode(nugetAsm); + if (node != null && focusNode) { + treeView.SelectedItems.Add(node); + lastNode = node; + } } } } + } finally { + this.handlingNugetPackageSelection = false; } break; default: @@ -845,7 +861,7 @@ namespace ICSharpCode.ILSpy treeView.FocusNode(lastNode); } } - + void RefreshCommandExecuted(object sender, ExecutedRoutedEventArgs e) { try { @@ -857,13 +873,13 @@ namespace ICSharpCode.ILSpy refreshInProgress = false; } } - + void SearchCommandExecuted(object sender, ExecutedRoutedEventArgs e) { SearchPane.Instance.Show(); } #endregion - + #region Decompile (TreeView_SelectionChanged) void TreeView_SelectionChanged(object sender, SelectionChangedEventArgs e) { @@ -872,10 +888,10 @@ namespace ICSharpCode.ILSpy if (SelectionChanged != null) SelectionChanged(sender, e); } - + Task decompilationTask; bool ignoreDecompilationRequests; - + void DecompileSelectedNodes(DecompilerTextViewState state = null, bool recordHistory = true) { if (ignoreDecompilationRequests) @@ -883,14 +899,14 @@ namespace ICSharpCode.ILSpy if (treeView.SelectedItems.Count == 0 && refreshInProgress) return; - + if (recordHistory) { var dtState = decompilerTextView.GetState(); - if(dtState != null) + if (dtState != null) history.UpdateCurrent(new NavigationState(dtState)); history.Record(new NavigationState(treeView.SelectedItems.OfType())); } - + if (treeView.SelectedItems.Count == 1) { ILSpyTreeNode node = treeView.SelectedItem as ILSpyTreeNode; if (node != null && node.View(decompilerTextView)) @@ -919,7 +935,7 @@ namespace ICSharpCode.ILSpy refreshInProgress = false; } } - + public DecompilerTextView TextView { get { return decompilerTextView; } } @@ -942,7 +958,7 @@ namespace ICSharpCode.ILSpy e.Handled = true; e.CanExecute = history.CanNavigateBack; } - + void BackCommandExecuted(object sender, ExecutedRoutedEventArgs e) { if (history.CanNavigateBack) { @@ -950,13 +966,13 @@ namespace ICSharpCode.ILSpy NavigateHistory(false); } } - + void ForwardCommandCanExecute(object sender, CanExecuteRoutedEventArgs e) { e.Handled = true; e.CanExecute = history.CanNavigateForward; } - + void ForwardCommandExecuted(object sender, ExecutedRoutedEventArgs e) { if (history.CanNavigateForward) { @@ -964,18 +980,17 @@ namespace ICSharpCode.ILSpy NavigateHistory(true); } } - + void NavigateHistory(bool forward) { var dtState = decompilerTextView.GetState(); - if(dtState != null) + if (dtState != null) history.UpdateCurrent(new NavigationState(dtState)); var newState = forward ? history.GoForward() : history.GoBack(); - + ignoreDecompilationRequests = true; treeView.SelectedItems.Clear(); - foreach (var node in newState.TreeNodes) - { + foreach (var node in newState.TreeNodes) { treeView.SelectedItems.Add(node); } if (newState.TreeNodes.Any()) @@ -983,9 +998,9 @@ namespace ICSharpCode.ILSpy ignoreDecompilationRequests = false; DecompileSelectedNodes(newState.ViewState, false); } - + #endregion - + protected override void OnStateChanged(EventArgs e) { base.OnStateChanged(e); @@ -993,7 +1008,7 @@ namespace ICSharpCode.ILSpy if (this.WindowState != System.Windows.WindowState.Minimized) sessionSettings.WindowState = this.WindowState; } - + protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); @@ -1024,7 +1039,7 @@ namespace ICSharpCode.ILSpy return loadedAssy.FileName; } - + #region Top/Bottom Pane management /// @@ -1038,14 +1053,12 @@ namespace ICSharpCode.ILSpy var pane2Height = pane2Row.Height; //only star height values are normalized. - if (!pane1Height.IsStar || !pane2Height.IsStar) - { + if (!pane1Height.IsStar || !pane2Height.IsStar) { return; } var totalHeight = pane1Height.Value + pane2Height.Value; - if (totalHeight == 0) - { + if (totalHeight == 0) { return; } @@ -1072,20 +1085,20 @@ namespace ICSharpCode.ILSpy } topPane.Visibility = Visibility.Visible; } - + void TopPane_CloseButtonClicked(object sender, EventArgs e) { sessionSettings.TopPaneSplitterPosition = topPaneRow.Height.Value / (topPaneRow.Height.Value + textViewRow.Height.Value); topPaneRow.MinHeight = 0; topPaneRow.Height = new GridLength(0); topPane.Visibility = Visibility.Collapsed; - + IPane pane = topPane.Content as IPane; topPane.Content = null; if (pane != null) pane.Closed(); } - + public void ShowInBottomPane(string title, object content) { bottomPaneRow.MinHeight = 100; @@ -1105,26 +1118,26 @@ namespace ICSharpCode.ILSpy } bottomPane.Visibility = Visibility.Visible; } - + void BottomPane_CloseButtonClicked(object sender, EventArgs e) { sessionSettings.BottomPaneSplitterPosition = bottomPaneRow.Height.Value / (bottomPaneRow.Height.Value + textViewRow.Height.Value); bottomPaneRow.MinHeight = 0; bottomPaneRow.Height = new GridLength(0); bottomPane.Visibility = Visibility.Collapsed; - + IPane pane = bottomPane.Content as IPane; bottomPane.Content = null; if (pane != null) pane.Closed(); } #endregion - + public void UnselectAll() { treeView.UnselectAll(); } - + public void SetStatus(string status, Brush foreground) { if (this.statusBar.Visibility == Visibility.Collapsed) @@ -1132,12 +1145,12 @@ namespace ICSharpCode.ILSpy this.StatusLabel.Foreground = foreground; this.StatusLabel.Text = status; } - + public ItemCollection GetMainMenuItems() { return mainMenu.Items; } - + public ItemCollection GetToolBarItems() { return toolBar.Items; diff --git a/ILSpy/Properties/AssemblyInfo.template.cs b/ILSpy/Properties/AssemblyInfo.template.cs index cdbdfecbf..f4a337c24 100644 --- a/ILSpy/Properties/AssemblyInfo.template.cs +++ b/ILSpy/Properties/AssemblyInfo.template.cs @@ -35,11 +35,11 @@ using System.Diagnostics.CodeAnalysis; internal static class RevisionClass { - public const string Major = "5"; + public const string Major = "6"; public const string Minor = "0"; public const string Build = "0"; public const string Revision = "$INSERTREVISION$"; - public const string VersionName = "preview4"; + public const string VersionName = "alpha1"; public const string FullVersion = Major + "." + Minor + "." + Build + ".$INSERTREVISION$$INSERTBRANCHPOSTFIX$$INSERTVERSIONNAMEPOSTFIX$"; } diff --git a/ILSpy/Properties/Resources.Designer.cs b/ILSpy/Properties/Resources.Designer.cs index b555a63a4..c5a662290 100644 --- a/ILSpy/Properties/Resources.Designer.cs +++ b/ILSpy/Properties/Resources.Designer.cs @@ -303,6 +303,15 @@ namespace ICSharpCode.ILSpy.Properties { } } + /// + /// Looks up a localized string similar to Assembly. + /// + public static string Assembly { + get { + return ResourceManager.GetString("Assembly", resourceCulture); + } + } + /// /// Looks up a localized string similar to The directory is not empty. File will be overwritten. ///Are you sure you want to continue?. @@ -511,6 +520,15 @@ namespace ICSharpCode.ILSpy.Properties { } } + /// + /// Looks up a localized string similar to Always show enum member values. + /// + public static string DecompilerSettings_AlwaysShowEnumMemberValues { + get { + return ResourceManager.GetString("DecompilerSettings.AlwaysShowEnumMemberValues", resourceCulture); + } + } + /// /// Looks up a localized string similar to Always use braces. /// @@ -1621,7 +1639,7 @@ namespace ICSharpCode.ILSpy.Properties { } /// - /// Looks up a localized string similar to Show _internal types and members. + /// Looks up a localized string similar to Show public, private and internal. /// public static string Show_internalTypesMembers { get { @@ -1629,6 +1647,15 @@ namespace ICSharpCode.ILSpy.Properties { } } + /// + /// Looks up a localized string similar to Show only _public types and members. + /// + public static string Show_publiconlyTypesMembers { + get { + return ResourceManager.GetString("Show_publiconlyTypesMembers", resourceCulture); + } + } + /// /// Looks up a localized string similar to Show all types and members. /// @@ -1684,7 +1711,7 @@ namespace ICSharpCode.ILSpy.Properties { } /// - /// Looks up a localized string similar to Show internal types and members. + /// Looks up a localized string similar to Show public, private and internal. /// public static string ShowInternalTypesMembers { get { @@ -1719,6 +1746,15 @@ namespace ICSharpCode.ILSpy.Properties { } } + /// + /// Looks up a localized string similar to Show only public types and members. + /// + public static string ShowPublicOnlyTypesMembers { + get { + return ResourceManager.GetString("ShowPublicOnlyTypesMembers", resourceCulture); + } + } + /// /// Looks up a localized string similar to Show state after this step. /// diff --git a/ILSpy/Properties/Resources.resx b/ILSpy/Properties/Resources.resx index d98c8cdcc..1a97f770f 100644 --- a/ILSpy/Properties/Resources.resx +++ b/ILSpy/Properties/Resources.resx @@ -370,10 +370,10 @@ You are using a nightly build newer than the latest release. - Show _internal types and members + Show public, private and internal - Show internal types and members + Show public, private and internal Stand by... @@ -754,4 +754,16 @@ Are you sure you want to continue? Remove dead stores (use with caution!) + + Always show enum member values + + + Show only public types and members + + + Show only _public types and members + + + Assembly + \ No newline at end of file diff --git a/ILSpy/Properties/app.config.template b/ILSpy/Properties/app.config.template index 58183137f..2d3b4521e 100644 --- a/ILSpy/Properties/app.config.template +++ b/ILSpy/Properties/app.config.template @@ -1,7 +1,7 @@  - + @@ -24,332 +24,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ILSpy/Search/AbstractSearchStrategy.cs b/ILSpy/Search/AbstractSearchStrategy.cs index 1a25f1698..80291ae31 100644 --- a/ILSpy/Search/AbstractSearchStrategy.cs +++ b/ILSpy/Search/AbstractSearchStrategy.cs @@ -157,10 +157,9 @@ namespace ICSharpCode.ILSpy.Search return new SearchResult { Member = item, Fitness = CalculateFitness(item), - Image = GetIcon(item), Name = GetLanguageSpecificName(item), - LocationImage = declaringType != null ? TypeTreeNode.GetIcon(declaringType) : Images.Namespace, Location = declaringType != null ? language.TypeToString(declaringType, includeNamespace: true) : item.Namespace, + Assembly = item.ParentModule.FullAssemblyName, ToolTip = item.ParentModule.PEFile?.FileName }; } @@ -204,7 +203,7 @@ namespace ICSharpCode.ILSpy.Search } } - ImageSource GetIcon(IEntity member) + internal static ImageSource GetIcon(IEntity member) { switch (member) { case ITypeDefinition t: diff --git a/ILSpy/Search/SearchPane.cs b/ILSpy/Search/SearchPane.cs index 501c2aade..3eb492740 100644 --- a/ILSpy/Search/SearchPane.cs +++ b/ILSpy/Search/SearchPane.cs @@ -373,22 +373,48 @@ namespace ICSharpCode.ILSpy public sealed class SearchResult : IMemberTreeNode { - public static readonly System.Collections.Generic.IComparer Comparer = new SearchResultComparer(); - + ImageSource image; + ImageSource locationImage; + + public static readonly IComparer Comparer = new SearchResultComparer(); + public IEntity Member { get; set; } public float Fitness { get; set; } - + + public string Assembly { get; set; } public string Location { get; set; } public string Name { get; set; } public object ToolTip { get; set; } - public ImageSource Image { get; set; } - public ImageSource LocationImage { get; set; } - + + public ImageSource Image { + get { + if (image == null) { + image = AbstractSearchStrategy.GetIcon(Member); + } + return image; + } + } + + public ImageSource LocationImage { + get { + if (locationImage == null) { + locationImage = Member.DeclaringTypeDefinition != null ? TypeTreeNode.GetIcon(Member.DeclaringTypeDefinition) : Images.Namespace; + } + return locationImage; + } + } + + public ImageSource AssemblyImage { + get { + return Images.Assembly; + } + } + public override string ToString() { return Name; } - + class SearchResultComparer : System.Collections.Generic.IComparer { public int Compare(SearchResult x, SearchResult y) @@ -398,8 +424,8 @@ namespace ICSharpCode.ILSpy } } - [ExportMainMenuCommand(Menu = nameof(Properties.Resources._View), Header =nameof(Properties.Resources.Search), MenuIcon = "Images/Find.png", MenuCategory = nameof(Properties.Resources.View), MenuOrder = 100)] - [ExportToolbarCommand(ToolTip = nameof(Properties.Resources.SearchCtrlShiftFOrCtrlE), ToolbarIcon = "Images/Find.png", ToolbarCategory = nameof(Properties.Resources.View), ToolbarOrder = 100)] + [ExportMainMenuCommand(Menu = nameof(Properties.Resources._View), Header =nameof(Properties.Resources.Search), MenuIcon = "Images/Search", MenuCategory = nameof(Properties.Resources.View), MenuOrder = 100)] + [ExportToolbarCommand(ToolTip = nameof(Properties.Resources.SearchCtrlShiftFOrCtrlE), ToolbarIcon = "Images/Search", ToolbarCategory = nameof(Properties.Resources.View), ToolbarOrder = 100)] sealed class ShowSearchCommand : CommandWrapper { public ShowSearchCommand() diff --git a/ILSpy/Search/SearchPane.xaml b/ILSpy/Search/SearchPane.xaml index e8b43efa2..5b46a5d28 100644 --- a/ILSpy/Search/SearchPane.xaml +++ b/ILSpy/Search/SearchPane.xaml @@ -41,7 +41,7 @@ @@ -60,7 +60,17 @@ - + + + + + + + + + + + diff --git a/ILSpy/TextView/ILAsm-Mode.xshd b/ILSpy/TextView/ILAsm-Mode.xshd index 20f545b85..12a5631ea 100644 --- a/ILSpy/TextView/ILAsm-Mode.xshd +++ b/ILSpy/TextView/ILAsm-Mode.xshd @@ -252,6 +252,10 @@ int16 int32 int64 + uint8 + uint16 + uint32 + uint64 float float32 float64 diff --git a/ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs b/ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs index 8aa8f8c0d..0a64b9ea7 100644 --- a/ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs +++ b/ILSpy/TreeNodes/AssemblyReferenceTreeNode.cs @@ -42,11 +42,9 @@ namespace ICSharpCode.ILSpy.TreeNodes public override object Text { get { return r.Name + ((System.Reflection.Metadata.EntityHandle)r.Handle).ToSuffixString(); } } - - public override object Icon { - get { return Images.Assembly; } - } - + + public override object Icon => Images.Assembly; + public override bool ShowExpander { get { if (r.Name == "mscorlib") diff --git a/ILSpy/TreeNodes/AssemblyTreeNode.cs b/ILSpy/TreeNodes/AssemblyTreeNode.cs index 13e2c1df2..10175007f 100644 --- a/ILSpy/TreeNodes/AssemblyTreeNode.cs +++ b/ILSpy/TreeNodes/AssemblyTreeNode.cs @@ -72,7 +72,7 @@ namespace ICSharpCode.ILSpy.TreeNodes if (LoadedAssembly.IsLoaded) { return LoadedAssembly.HasLoadError ? Images.AssemblyWarning : Images.Assembly; } else { - return Images.AssemblyLoading; + return Images.FindAssembly; } } } @@ -314,7 +314,7 @@ namespace ICSharpCode.ILSpy.TreeNodes } } - [ExportContextMenuEntry(Header = nameof(Resources._Remove), Icon = "images/Delete.png")] + [ExportContextMenuEntry(Header = nameof(Resources._Remove), Icon = "images/Delete")] sealed class RemoveAssembly : IContextMenuEntry { public bool IsVisible(TextViewContext context) @@ -339,7 +339,7 @@ namespace ICSharpCode.ILSpy.TreeNodes } } - [ExportContextMenuEntry(Header = nameof(Resources._Reload), Icon = "images/Refresh.png")] + [ExportContextMenuEntry(Header = nameof(Resources._Reload), Icon = "images/Refresh")] sealed class ReloadAssembly : IContextMenuEntry { public bool IsVisible(TextViewContext context) diff --git a/ILSpy/TreeNodes/BaseTypesEntryNode.cs b/ILSpy/TreeNodes/BaseTypesEntryNode.cs index 3c96c40dd..df8121e84 100644 --- a/ILSpy/TreeNodes/BaseTypesEntryNode.cs +++ b/ILSpy/TreeNodes/BaseTypesEntryNode.cs @@ -69,7 +69,8 @@ namespace ICSharpCode.ILSpy.TreeNodes public override object Text => this.Language.TypeToString(type, includeNamespace: true) + handle.ToSuffixString(); - public override object Icon => isInterface ? Images.Interface : Images.Class; + public override object Icon => + isInterface ? Images.Interface : Images.Class; protected override void LoadChildren() { diff --git a/ILSpy/TreeNodes/CopyFullyQualifiedNameContextMenuEntry.cs b/ILSpy/TreeNodes/CopyFullyQualifiedNameContextMenuEntry.cs index 9b6b24163..a66969add 100644 --- a/ILSpy/TreeNodes/CopyFullyQualifiedNameContextMenuEntry.cs +++ b/ILSpy/TreeNodes/CopyFullyQualifiedNameContextMenuEntry.cs @@ -7,7 +7,7 @@ using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy.TreeNodes { - [ExportContextMenuEntry(Header = nameof(Resources.CopyName), Icon = "images/Copy.png", Order = 9999)] + [ExportContextMenuEntry(Header = nameof(Resources.CopyName), Icon = "images/Copy", Order = 9999)] public class CopyFullyQualifiedNameContextMenuEntry : IContextMenuEntry { public bool IsVisible(TextViewContext context) diff --git a/ILSpy/TreeNodes/ReferenceFolderTreeNode.cs b/ILSpy/TreeNodes/ReferenceFolderTreeNode.cs index fde4630f1..a23a4bfe5 100644 --- a/ILSpy/TreeNodes/ReferenceFolderTreeNode.cs +++ b/ILSpy/TreeNodes/ReferenceFolderTreeNode.cs @@ -18,7 +18,6 @@ using System; using System.Linq; -using SRM = System.Reflection.Metadata; using System.Windows.Threading; using ICSharpCode.Decompiler; using ICSharpCode.Decompiler.Metadata; @@ -40,19 +39,11 @@ namespace ICSharpCode.ILSpy.TreeNodes this.parentAssembly = parentAssembly; this.LazyLoading = true; } - - public override object Text { - get { return Resources.References; } - } - - public override object Icon { - get { return Images.ReferenceFolderClosed; } - } - - public override object ExpandedIcon { - get { return Images.ReferenceFolderOpen; } - } - + + public override object Text => Resources.References; + + public override object Icon => Images.ReferenceFolder; + protected override void LoadChildren() { var metadata = module.Metadata; diff --git a/ILSpy/TreeNodes/ResourceListTreeNode.cs b/ILSpy/TreeNodes/ResourceListTreeNode.cs index c67c9d4b1..e379160a2 100644 --- a/ILSpy/TreeNodes/ResourceListTreeNode.cs +++ b/ILSpy/TreeNodes/ResourceListTreeNode.cs @@ -37,19 +37,13 @@ namespace ICSharpCode.ILSpy.TreeNodes this.LazyLoading = true; this.module = module; } - - public override object Text { - get { return Resources._Resources; } - } - - public override object Icon { - get { return Images.FolderClosed; } - } - public override object ExpandedIcon { - get { return Images.FolderOpen; } - } - + public override object Text => Resources._Resources; + + public override object Icon => Images.FolderClosed; + + public override object ExpandedIcon => Images.FolderOpen; + protected override void LoadChildren() { foreach (Resource r in module.Resources.OrderBy(m => m.Name, NaturalStringComparer.Instance)) diff --git a/ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs b/ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs index 2dbbcc271..156590b8d 100644 --- a/ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs @@ -59,10 +59,7 @@ namespace ICSharpCode.ILSpy.TreeNodes { } - public override object Icon - { - get { return Images.ResourceImage; } - } + public override object Icon => Images.ResourceImage; public override bool View(DecompilerTextView textView) { diff --git a/ILSpy/TreeNodes/ResourceNodes/IconResourceEntryNode.cs b/ILSpy/TreeNodes/ResourceNodes/IconResourceEntryNode.cs index de98a7aa1..989450c7b 100644 --- a/ILSpy/TreeNodes/ResourceNodes/IconResourceEntryNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/IconResourceEntryNode.cs @@ -58,10 +58,7 @@ namespace ICSharpCode.ILSpy.TreeNodes { } - public override object Icon - { - get { return Images.ResourceImage; } - } + public override object Icon => Images.ResourceImage; public override bool View(DecompilerTextView textView) { diff --git a/ILSpy/TreeNodes/ResourceNodes/ImageListResourceEntryNode.cs b/ILSpy/TreeNodes/ResourceNodes/ImageListResourceEntryNode.cs index fb8b2199f..97710629f 100644 --- a/ILSpy/TreeNodes/ResourceNodes/ImageListResourceEntryNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/ImageListResourceEntryNode.cs @@ -58,10 +58,7 @@ namespace ICSharpCode.ILSpy.TreeNodes get { return key; } } - public override object Icon - { - get { return Images.ResourceImage; } - } + public override object Icon => Images.ResourceImage; protected override void LoadChildren() { diff --git a/ILSpy/TreeNodes/ResourceNodes/ImageResourceEntryNode.cs b/ILSpy/TreeNodes/ResourceNodes/ImageResourceEntryNode.cs index 0c8ff07ea..2e7578e8f 100644 --- a/ILSpy/TreeNodes/ResourceNodes/ImageResourceEntryNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/ImageResourceEntryNode.cs @@ -65,10 +65,7 @@ namespace ICSharpCode.ILSpy.TreeNodes { } - public override object Icon - { - get { return Images.ResourceImage; } - } + public override object Icon => Images.ResourceImage; public override bool View(DecompilerTextView textView) { diff --git a/ILSpy/TreeNodes/ResourceNodes/ResourceEntryNode.cs b/ILSpy/TreeNodes/ResourceNodes/ResourceEntryNode.cs index ec74ad193..5e0db07d1 100644 --- a/ILSpy/TreeNodes/ResourceNodes/ResourceEntryNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/ResourceEntryNode.cs @@ -32,21 +32,11 @@ namespace ICSharpCode.ILSpy.TreeNodes private readonly string key; private readonly Stream data; - public override object Text - { - get { return this.key; } - } + public override object Text => this.key; - public override object Icon - { - get { return Images.Resource; } - } - - protected Stream Data - { - get { return data; } - } + public override object Icon => Images.Resource; + protected Stream Data => data; public ResourceEntryNode(string key, Stream data) { diff --git a/ILSpy/TreeNodes/ResourceNodes/ResourceTreeNode.cs b/ILSpy/TreeNodes/ResourceNodes/ResourceTreeNode.cs index 3433f70d7..ff57aa944 100644 --- a/ILSpy/TreeNodes/ResourceNodes/ResourceTreeNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/ResourceTreeNode.cs @@ -36,48 +36,40 @@ namespace ICSharpCode.ILSpy.TreeNodes /// public class ResourceTreeNode : ILSpyTreeNode { - readonly Resource r; - public ResourceTreeNode(Resource r) { if (r.IsNil) throw new ArgumentNullException(nameof(r)); - this.r = r; + this.Resource = r; } - - public Resource Resource { - get { return r; } - } - - public override object Text { - get { return r.Name; } - } - - public override object Icon { - get { return Images.Resource; } - } - + + public Resource Resource { get; } + + public override object Text => Resource.Name; + + public override object Icon => Images.Resource; + public override FilterResult Filter(FilterSettings settings) { - if (settings.ShowApiLevel == ApiVisibility.PublicOnly && (r.Attributes & ManifestResourceAttributes.VisibilityMask) == ManifestResourceAttributes.Private) + if (settings.ShowApiLevel == ApiVisibility.PublicOnly && (Resource.Attributes & ManifestResourceAttributes.VisibilityMask) == ManifestResourceAttributes.Private) return FilterResult.Hidden; - if (settings.SearchTermMatches(r.Name)) + if (settings.SearchTermMatches(Resource.Name)) return FilterResult.Match; else return FilterResult.Hidden; } - + public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) { - language.WriteCommentLine(output, string.Format("{0} ({1}, {2})", r.Name, r.ResourceType, r.Attributes)); - + language.WriteCommentLine(output, string.Format("{0} ({1}, {2})", Resource.Name, Resource.ResourceType, Resource.Attributes)); + ISmartTextOutput smartOutput = output as ISmartTextOutput; if (smartOutput != null) { smartOutput.AddButton(Images.Save, Resources.Save, delegate { Save(MainWindow.Instance.TextView); }); output.WriteLine(); } } - + public override bool View(DecompilerTextView textView) { Stream s = Resource.TryOpenStream(); @@ -99,7 +91,7 @@ namespace ICSharpCode.ILSpy.TreeNodes } return false; } - + public override bool Save(DecompilerTextView textView) { Stream s = Resource.TryOpenStream(); @@ -115,7 +107,7 @@ namespace ICSharpCode.ILSpy.TreeNodes } return true; } - + public static ILSpyTreeNode Create(Resource resource) { ILSpyTreeNode result = null; diff --git a/ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs b/ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs index c1d908481..74ec9e049 100644 --- a/ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs @@ -60,9 +60,7 @@ namespace ICSharpCode.ILSpy.TreeNodes this.LazyLoading = true; } - public override object Icon { - get { return Images.ResourceResourcesFile; } - } + public override object Icon => Images.ResourceResourcesFile; protected override void LoadChildren() { diff --git a/ILSpy/TreeNodes/SearchMsdnContextMenuEntry.cs b/ILSpy/TreeNodes/SearchMsdnContextMenuEntry.cs index 80e733988..8b24deb74 100644 --- a/ILSpy/TreeNodes/SearchMsdnContextMenuEntry.cs +++ b/ILSpy/TreeNodes/SearchMsdnContextMenuEntry.cs @@ -23,7 +23,7 @@ using System.Threading; namespace ICSharpCode.ILSpy.TreeNodes { - [ExportContextMenuEntry(Header = nameof(Resources.SearchMSDN), Icon = "images/SearchMsdn.png", Order = 9999)] + [ExportContextMenuEntry(Header = nameof(Resources.SearchMSDN), Icon = "images/SearchMsdn", Order = 9999)] internal sealed class SearchMsdnContextMenuEntry : IContextMenuEntry { private static string msdnAddress = "http://msdn.microsoft.com/{1}/library/{0}"; diff --git a/ILSpy/TreeNodes/TypeTreeNode.cs b/ILSpy/TreeNodes/TypeTreeNode.cs index 3ef91c411..750c5bc61 100644 --- a/ILSpy/TreeNodes/TypeTreeNode.cs +++ b/ILSpy/TreeNodes/TypeTreeNode.cs @@ -112,11 +112,12 @@ namespace ICSharpCode.ILSpy.TreeNodes public static ImageSource GetIcon(ITypeDefinition type) { - return Images.GetIcon(GetTypeIcon(type), GetOverlayIcon(type)); + return Images.GetIcon(GetTypeIcon(type, out bool isStatic), GetOverlayIcon(type), isStatic); } - internal static TypeIcon GetTypeIcon(IType type) + internal static TypeIcon GetTypeIcon(IType type, out bool isStatic) { + isStatic = false; switch (type.Kind) { case TypeKind.Interface: return TypeIcon.Interface; @@ -127,8 +128,7 @@ namespace ICSharpCode.ILSpy.TreeNodes case TypeKind.Enum: return TypeIcon.Enum; default: - if (type.GetDefinition()?.IsStatic == true) - return TypeIcon.StaticClass; + isStatic = type.GetDefinition()?.IsStatic == true; return TypeIcon.Class; } } diff --git a/ILSpy/app.manifest b/ILSpy/app.manifest index f9ecc04dd..666f96904 100644 --- a/ILSpy/app.manifest +++ b/ILSpy/app.manifest @@ -51,7 +51,9 @@ also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. --> - true + + PerMonitorV2, PerMonitor + True true diff --git a/README.md b/README.md index 7815ad7c0..71d46c53e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ILSpy is the open-source .NET assembly browser and decompiler. -Download: [latest release](https://github.com/icsharpcode/ILSpy/releases) | [latest CI build (master)](https://ci.appveyor.com/api/projects/icsharpcode/ilspy/artifacts/ILSpy_binaries.zip?branch=master&job=Configuration%3A+Release) +Download: [latest release](https://github.com/icsharpcode/ILSpy/releases) | [latest CI build (master)](https://ci.appveyor.com/api/projects/icsharpcode/ilspy/artifacts/ILSpy_binaries.zip?branch=master&job=Configuration%3A+Release) | [Microsoft Store (RC & RTM versions only)](https://www.microsoft.com/store/apps/9MXFBKFVSQ13) CI Build Nuget Feed (master): https://ci.appveyor.com/nuget/ilspy-masterfeed @@ -11,7 +11,7 @@ Decompiler Frontends Aside from the WPF UI ILSpy (downloadable via Releases, see also [plugins](https://github.com/icsharpcode/ILSpy/wiki/Plugins)), the following other frontends are available: -* Visual Studio 2017 extension [marketplace](https://marketplace.visualstudio.com/items?itemName=SharpDevelopTeam.ILSpy) +* Visual Studio 2017/2019 extension [marketplace](https://marketplace.visualstudio.com/items?itemName=SharpDevelopTeam.ILSpy) * Visual Studio Code Extension [repository](https://github.com/icsharpcode/ilspy-vscode) | [marketplace](https://marketplace.visualstudio.com/items?itemName=icsharpcode.ilspy-vscode) * [ICSharpCode.Decompiler](https://www.nuget.org/packages/ICSharpCode.Decompiler/) NuGet for your own projects * Linux/Mac/Windows ILSpy UI based on [Avalonia](http://www.avaloniaui.net/) - check out https://github.com/icsharpcode/AvaloniaILSpy @@ -83,3 +83,9 @@ How to contribute - If you want to contribute a pull request, please add https://gist.github.com/siegfriedpammer/75700ea61609eb22714d21885e4eb084 to your `.git/hooks` to prevent checking in code with wrong indentation. We use tabs and not spaces. The build server runs the same script, so any pull requests using wrong indentation will fail. Current and past [contributors](https://github.com/icsharpcode/ILSpy/graphs/contributors). + +Privacy Policy for ILSpy +------------------------ + +ILSpy does not collect any personally identifiable information, nor does it send user files to 3rd party services. +ILSpy does not use any APM (Application Performance Management) service to collect telemetry or metrics. diff --git a/SharpTreeView/ICSharpCode.TreeView.csproj b/SharpTreeView/ICSharpCode.TreeView.csproj index 77bf6c271..aad980da6 100644 --- a/SharpTreeView/ICSharpCode.TreeView.csproj +++ b/SharpTreeView/ICSharpCode.TreeView.csproj @@ -2,7 +2,7 @@ - net462 + net472 False diff --git a/SharpTreeView/Themes/Generic.xaml b/SharpTreeView/Themes/Generic.xaml index 00b807af0..46c49793d 100644 --- a/SharpTreeView/Themes/Generic.xaml +++ b/SharpTreeView/Themes/Generic.xaml @@ -250,20 +250,20 @@ - - - - - - - - + + + + + + - net462 + net472 Test.Plugin False diff --git a/appveyor.yml b/appveyor.yml index 13806b0ce..c3efe5a38 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,13 +23,13 @@ build_script: - msbuild ILSpy.sln /v:minimal /p:ResolveNuGetPackages=false "/logger:%ProgramFiles%\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" after_build: -- 7z a ILSpy_binaries.zip %APPVEYOR_BUILD_FOLDER%\ILSpy\bin\%configuration%\net462\*.dll %APPVEYOR_BUILD_FOLDER%\ILSpy\bin\%configuration%\net462\*.exe %APPVEYOR_BUILD_FOLDER%\ILSpy\bin\%configuration%\net462\*.config %APPVEYOR_BUILD_FOLDER%\ILSpy\bin\%configuration%\net462\*\ILSpy.resources.dll +- 7z a ILSpy_binaries.zip %APPVEYOR_BUILD_FOLDER%\ILSpy\bin\%configuration%\net472\*.dll %APPVEYOR_BUILD_FOLDER%\ILSpy\bin\%configuration%\net472\*.exe %APPVEYOR_BUILD_FOLDER%\ILSpy\bin\%configuration%\net472\*.config %APPVEYOR_BUILD_FOLDER%\ILSpy\bin\%configuration%\net472\*\ILSpy.resources.dll test: assemblies: - - 'ICSharpCode.Decompiler.Tests\bin\%configuration%\net462\ICSharpCode.Decompiler.Tests.exe' - - 'ILSpy.Tests\bin\%configuration%\net462\ILSpy.Tests.exe' - - 'ILSpy.BamlDecompiler.Tests\bin\%configuration%\net462\ILSpy.BamlDecompiler.Tests.dll' + - 'ICSharpCode.Decompiler.Tests\bin\%configuration%\net472\ICSharpCode.Decompiler.Tests.exe' + - 'ILSpy.Tests\bin\%configuration%\net472\ILSpy.Tests.exe' + - 'ILSpy.BamlDecompiler.Tests\bin\%configuration%\net472\ILSpy.BamlDecompiler.Tests.dll' after_test: - python BuildTools\tidy.py diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f7a9fa21d..e14de2b42 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,7 +9,7 @@ pr: variables: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - BuildPlatform: Any CPU + BuildPlatform: Any CPU jobs: - job: Build @@ -40,7 +40,7 @@ jobs: - task: DotNetCoreInstaller@0 inputs: - version: '3.0.100-preview5-011568' + version: '3.0.100-preview9-014004' - powershell: .\BuildTools\pipelines-install.ps1 displayName: Install @@ -67,15 +67,15 @@ jobs: inputs: testSelector: testAssemblies testAssemblyVer2: | - ICSharpCode.Decompiler.Tests\bin\$(BuildConfiguration)\net462\ICSharpCode.Decompiler.Tests.exe - ILSpy.Tests\bin\$(BuildConfiguration)\net462\ILSpy.Tests.exe - ILSpy.BamlDecompiler.Tests\bin\$(BuildConfiguration)\net462\ILSpy.BamlDecompiler.Tests.dll + ICSharpCode.Decompiler.Tests\bin\$(BuildConfiguration)\net472\ICSharpCode.Decompiler.Tests.exe + ILSpy.Tests\bin\$(BuildConfiguration)\net472\ILSpy.Tests.exe + ILSpy.BamlDecompiler.Tests\bin\$(BuildConfiguration)\net472\ILSpy.BamlDecompiler.Tests.dll - task: ArchiveFiles@1 displayName: Create zip inputs: archiveType: zip - rootFolder: ILSpy/bin/$(BuildConfiguration)/net462 + rootFolder: ILSpy/bin/$(BuildConfiguration)/net472 archiveFile: $(Build.ArtifactStagingDirectory)\$(ReleaseChannel)\ILSpy.$(Build.BuildNumber).zip includeRootFolder: false condition: and(succeeded(), eq(variables['ReleaseChannel'], 'Zip')) diff --git a/global.json b/global.json index 5fff0f519..05c896433 100644 --- a/global.json +++ b/global.json @@ -3,6 +3,6 @@ "MSBuild.Sdk.Extras": "2.0.24" }, "sdk": { - "version": "3.0.100-preview" + "version": "3.0.100-rc1" } }