public void CanTargetExtremelyDeepNestedDelegate() { // Create the target. var target = new DisassemblyTarget(DisassemblyTargetType.Delegate, "AcceptanceModel.ClassWithNestedClass.ClassNestedInClass.DeepNestedClassInClassNestedInClass.VeryDeepNestedStructInDeepNestedClassInClassNestedInClass.DelegateInVeryDeepNestedStructInDeepNestedClassInClassNestedInClass"); // Try and find the entity. var entity = disassembledAssembly.FindDisassembledEntity(target); // Make sure we have found the entity. Assert.IsNotNull(entity, string.Format("Failed to find target {0}.", target)); }
public void CanTargetNestedClass() { // Create the target. var target = new DisassemblyTarget(DisassemblyTargetType.Class, "AcceptanceModel.ClassWithNestedClass.ClassNestedInClass"); // Try and find the entity. var entity = disassembledAssembly.FindDisassembledEntity(target); // Make sure we have found the entity. Assert.IsNotNull(entity, string.Format("Failed to find target {0}.", target)); }
public void CanTargetMethod() { // Create the target. var target = new DisassemblyTarget(DisassemblyTargetType.Method, "AcceptanceModel.ExampleClass.ExampleFunction"); // Try and find the entity. var entity = disassembledAssembly.FindDisassembledEntity(target); // Make sure we have found the entity. Assert.IsNotNull(entity, string.Format("Failed to find target {0}.", target)); }
public void CanTargetTemplateMethodInClassWithTemplateMethods() { // Create the target. var target = new DisassemblyTarget(DisassemblyTargetType.Class, "AcceptanceModel.ClassWithTemplateMethods"); // Try and find the entity. var entity = disassembledAssembly.FindDisassembledEntity(target) as DisassembledClass; Assert.IsNotNull(entity); // Do we have the template method? var templateMethod = entity.Methods.FirstOrDefault(m => m.FullName == @"AcceptanceModel.ClassWithTemplateMethods.WriteObject<T>"); // Make sure we have found the entity. Assert.IsNotNull(templateMethod, string.Format("Failed to find target {0}.", target)); }
public static void SearchAssembly() { // Disassemble the assembly. DisassembledAssembly disassembledAssembly = Disassembler.DisassembleAssembly(@"SomeAssembly.dll"); // Create a disassembly target that targets the interface named 'ISomeInterface'. DisassemblyTarget target = new DisassemblyTarget(DisassemblyTargetType.Interface, @"SimeAssembly.ISomeInterface"); // Search for the interface. DisassembledEntity entity = disassembledAssembly.FindDisassembledEntity(target); // If we found it, show the IL. if (entity != null) { Console.WriteLine(entity.RawIL); } }
public void InitialiseView(IDisassemblyProvider disassemblyProvider, DisassemblyTarget disassemblyTarget) { // We can start disassembling. ViewModel.IsDisassembling = true; // Execute the task to disassemble the assembly. disassemblyProvider .DisassembleAssembly() .ContinueWith(t => { ViewModel.DisassembledAssembly = t.Result; // Can we find the disassembled entity we're targetting? var disassembledEntity = t.Result.FindDisassembledEntity(disassemblyTarget); SelectedEntity = disassembledEntity ?? t.Result; OnSelectedEntityChanged(this, new DependencyPropertyChangedEventArgs(SelectedEntityProperty, null, disassembledEntity)); // Set the content of the disassembly editor. ViewModel.IsDisassembling = false; }, TaskScheduler.FromCurrentSynchronizationContext()); ViewModel.SelectBreadcrumbCommand.Executed += SelectBreadcrumbCommand_Executed; }
public void InitialiseView(IDisassemblyProvider disassemblyProvider, DisassemblyTarget disassemblyTarget) { SilView.InitialiseView(disassemblyProvider, disassemblyTarget); }