1 / 24

Extending .Net Reflector: Writing Your own Add-ins

Extending .Net Reflector: Writing Your own Add-ins. Jason Haley Seattle Code Camp 4 November 2008. Who is this guy?. Using .Net since Fall 2001 (beta 2) MCSD.Net Debris.Net: A .Net disassembler (in progress) .Net related link blog “Interesting Finds” Author of a few Reflector Add-ins

rolf
Download Presentation

Extending .Net Reflector: Writing Your own Add-ins

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Extending .Net Reflector:Writing Your own Add-ins Jason Haley Seattle Code Camp 4 November 2008

  2. Who is this guy? • Using .Net since Fall 2001 (beta 2) • MCSD.Net • Debris.Net: A .Net disassembler (in progress) • .Net related link blog “Interesting Finds” • Author of a few Reflector Add-ins • The team software guy, Open Seas

  3. Ways to extend Reflector • Additional languages • Change the disassembler output • Display different assembly information • Add ‘missing’ functionality • Create new functionality

  4. Demo Simplest Reflector Add-in

  5. Agenda • Ways to Extend .Net Reflector • .Net Reflector Add-in Model Overview • Getting Started

  6. Languages • Disassembler/Decompiler add-ins • Implement ILanguage, plus a few others • Often paired with a browser/viewer

  7. Demo PowerShellLanguage

  8. Viewers/Browsers • UI/Visual add-ins • WinForms Controls to display decompiler output

  9. Demo ClassView, CodeModelView

  10. Metadata applications • Provide useful extensions to Reflector • Use the assembly information in some way • Use other Reflector functionality

  11. Demo Review

  12. Agenda • Ways to Extend .Net Reflector • .Net Reflector Add-in Model Overview • Getting Started

  13. Introducing the code model • Resides in Reflector.exe • Interface driven • Reflector namespace • Majority of non metadata interfaces • Managers • Reflector.CodeModel namespace • Contains the metadata interfaces • Reflector.CodeModel.Memory namespace • Contains some concrete objects

  14. The visible parts • IAssemblyManager • Tree view of loaded assemblies • ICommandBarManager • Menus, Context Menus, Toolbar • ILanguageManager • Language drop down list on Toolbar • IPropertyPageManager • Dialog shown from View-> Options

  15. Demo ReflectorUI

  16. The not-so visible parts • IWindowManager • Access to StatusBar, ComandBars, Windows • IConfigurationManager • Access to cfg file storage • ITranslationManager • Access disassembler factory • ApplicationManager • Not used by add-ins, provides a IServiceProvider

  17. Demo EnumAddin, ReflectorWrapper

  18. Agenda • Ways to Extend .Net Reflector • .Net Reflector Add-in Model Overview • Getting Started

  19. Writing your own add-in • Where to start • CodePlex site has articles and code • Existing add-ins • My addins page • Add-ins to start with • ClassViewer • CodeModelViewer

  20. Reference Points I Use • Solution from CodePlex site • AssemblyCollection.Sort • Enum Addin • Boxing Count • Create Using • Code Shortcut • Open Zip

  21. Tips for Creating Addins • Look at the source of similar addins • Reflector Add-in Starter Kit • Create a shortcut to the reflector.exe in bin directory • Add your add-in, then close it (generates the .cfg file) • Set bookmarks for testing • System.Diagnostics.Debugger.Break() • (Vista) Taskkill /im reflector.exe

  22. Summary • Reflector.exe has the code model • Get the starter kit • Download the add-ins on CodePlex • Look at the code for existing add-ins • Create your own – big or small

  23. Web Resources • .Net Reflector – http://www.red-gate.com/products/reflector/ • .Net Reflector Add-ins – http://codeplex.com/reflectoraddins/ • .Net Reflector Forum - http://www.red-gate.com/MessageBoard/viewforum.php?f=85 • My material – http://jasonhaley.com/addins/

  24. Questions and Discussion • Any additional tips on using Reflector? • Any ideas on creating additional add-ins? • A few on my list: • Interface usage helper • Assembly reference mismatch finder • F# language • Other languages? • Obfuscation name mapper • Add-in manager modeled after Firefox

More Related