|
|
@ -10,6 +10,7 @@ using ICSharpCode.Decompiler.CSharp; |
|
|
|
using ICSharpCode.Decompiler.IL; |
|
|
|
using ICSharpCode.Decompiler.IL; |
|
|
|
using ICSharpCode.Decompiler.IL.Transforms; |
|
|
|
using ICSharpCode.Decompiler.IL.Transforms; |
|
|
|
using ICSharpCode.Decompiler.TypeSystem; |
|
|
|
using ICSharpCode.Decompiler.TypeSystem; |
|
|
|
|
|
|
|
using ICSharpCode.Decompiler.Util; |
|
|
|
using Mono.Cecil; |
|
|
|
using Mono.Cecil; |
|
|
|
|
|
|
|
|
|
|
|
namespace ILSpy.BamlDecompiler |
|
|
|
namespace ILSpy.BamlDecompiler |
|
|
@ -34,9 +35,9 @@ namespace ILSpy.BamlDecompiler |
|
|
|
this.assembly = assembly; |
|
|
|
this.assembly = assembly; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Dictionary<long, EventRegistration[]> DecompileEventMappings(string fullTypeName, CancellationToken cancellationToken) |
|
|
|
public List<(LongSet, EventRegistration[])> DecompileEventMappings(string fullTypeName, CancellationToken cancellationToken) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var result = new Dictionary<long, EventRegistration[]>(); |
|
|
|
var result = new List<(LongSet, EventRegistration[])>(); |
|
|
|
TypeDefinition type = this.assembly.MainModule.GetType(fullTypeName); |
|
|
|
TypeDefinition type = this.assembly.MainModule.GetType(fullTypeName); |
|
|
|
|
|
|
|
|
|
|
|
if (type == null) |
|
|
|
if (type == null) |
|
|
@ -70,8 +71,7 @@ namespace ILSpy.BamlDecompiler |
|
|
|
if (ilSwitch != null) { |
|
|
|
if (ilSwitch != null) { |
|
|
|
foreach (var section in ilSwitch.Sections) { |
|
|
|
foreach (var section in ilSwitch.Sections) { |
|
|
|
var events = FindEvents(section.Body); |
|
|
|
var events = FindEvents(section.Body); |
|
|
|
foreach (long id in section.Labels.Values) |
|
|
|
result.Add((section.Labels, events)); |
|
|
|
result.Add(id, events); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
foreach (var ifInst in function.Descendants.OfType<IfInstruction>()) { |
|
|
|
foreach (var ifInst in function.Descendants.OfType<IfInstruction>()) { |
|
|
@ -82,7 +82,7 @@ namespace ILSpy.BamlDecompiler |
|
|
|
if (!comp.Right.MatchLdcI4(out id)) |
|
|
|
if (!comp.Right.MatchLdcI4(out id)) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
var events = FindEvents(comp.Kind == ComparisonKind.Inequality ? ifInst.FalseInst : ifInst.TrueInst); |
|
|
|
var events = FindEvents(comp.Kind == ComparisonKind.Inequality ? ifInst.FalseInst : ifInst.TrueInst); |
|
|
|
result.Add(id, events); |
|
|
|
result.Add((new LongSet(id), events)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
|