• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
works guo

成功的渴望与生俱来---- 成功是获得赞美与尊重的最有效的途径
博客园    首页    新随笔    联系   管理    订阅  订阅

.NET Reflector 资料收集

这是我收集的一些.net Reflector的资料。可能有的暂时不会用上,但遇到要使用的时候,就会体现出今天的辛苦的成果啦!

Introduction to the .NET Reflector Add-In Model

原文地址


Reflector add-in 是一个dll/exe 的assembly文件,里面有一个包,包是一个继承IPackage接口,接口里面定义了Load,Unload 方法,一个IServiceProvider是可以在已经被传递期间加载和允许出入一个服务的子集,是Reflector 对象模型的一部分。

 



1:HelloWorld Add-In

这个Simple创建一个继承IPackage接口的包,用Load方法为 IWindowManager服务实现一个IServiceProvider,允许你与Reflector的窗口系统交互。而ShowMessage方法是用来显示信息的。

using System;
using Reflector;
 
internal class HelloWorldPackage : IPackage
{
    
private IWindowManager windowManager;
 
    
public void Load(IServiceProvider serviceProvider)
    
{
        
this.windowManager = (IWindowManager) serviceProvider.GetService(typeof(IWindowManager));
        
this.windowManager.ShowMessage("Loading HelloWorld!");
    }

 
    
public void Unload()
    
{
        
this.windowManager.ShowMessage("Unloading HelloWorld!");
    }

}



这个代码编译后进入add-in dll之后就像引用库样引用Reflector.exe。

csc.exe /target:library /out:HelloWorld.dll *.cs /r:Reflector.exe

这个add-in能复制你的Reflector directory(目录)和加载使用时使用菜单里面的View|Add-Ins。


2:Services Available to Add-In Authors

确认表的list,大部分共同使用服务,能被通过IServiceProvider.的GetService方法来访问。

Service Description
IAssemblyBrowser 在ActiveItem(激活选项)中维持当前选中代码模型对象。你能指定一个代码模型对象就像使用IMethodDeclaration接口从你的程序中的ActiveItem改变在浏览窗口中当前的选种项。
IWindowManager  管理的应用程序窗口和面版窗口。你能添加自己的面版窗口到窗口集合中。它会为你创建IWindow hosting frame。
ICommandBarManager 管理Reflector菜单条,工具条和上下文菜单。你能按照它的标示符查找一个上下文菜单,并添加item到它里面(ICommandBarManager)
IConfigurationManager 管理项来于Reflector的configuration文件,这个文件是IConfiguration对象的一个子集,List的选项被加上像属性名样的"0","1","2"等字符。
IAssemblyManager 维持当前List中加载的assembly。LoadFile是使用来从硬盘中加载一个assembly文件。Unload允许从内存中卸载一个assembly文件。这个assembly文件集合将保存当前所加载的所有的assembly文件。
ILanguageManager 管理不同编程语言格式的模块,ActiveLanguage(当前使用的语言)属性呈现当前ILanguage对象,你能实现ILanguage interface去添加你自己的语言并代码呈现。使用RegisterLanguage 添加你的add-in到 ILanguageManager中。


3:Adding Items to Command Bars and Context Menus


ICommandBarManager服务语序你添加菜单选项到Reflector的主要菜单和上下文菜单中(context menus)。每一个子菜单和上下文菜单都要在CommanBars集合中注册一个标识名.下面表常规的标识符:


Identifier Description
Tools 工具菜单显示如主菜单的一部分。 
Browser.Assembly 上下文菜单适合于前选中的assembly.
Browser.Namespace 上下文菜单适合于前选中的namespace. 
Browser.TypeDeclaration 上下文菜单适合于前选中的declaration. 
Browser.MethodDeclaration 上下文菜单适合于前选中的 method declaration.



二:How to Setup the Build Environment


1:Download and unzip the latest source snapshot from the Source Code section.
2:Copy Reflector.exe to the \Build directory.
3:Build the add-ins by running msbuild ReflectorAddIns.sln from \Source.
4:The build output will be in the \Build folder. 



三:How to Setup an Enlistment


(1)发送信息给自己的工程并请求获得一个成员。
(2)安装Team Explorer client需要下面步骤:Obtaining the Team Explorer Client(http://www.codeplex.com/Wiki/View.aspx?
ProjectName=CodePlex&title=Obtaining the Team Explorer Client)
(3)并使用下面信息连接工程:
Server:   tfs03.codeplex.com
Port:     443
Protocol: https
Username: snd\<username>_cp
Password: <password>



指导方针:

需要添加这些list:

(1)Each add-in has a source folder under \main\Source. ReflectorAddIns.sln builds most of the add-ins to the \main\Build directory.
(2)DO NOT CHECK-IN REFLECTOR.EXE.
(3)All add-ins should be built against .NET Framework 1.0 if possible. To enable this you can specify the .NET 1.0 build target in ReflectorAddIns.sln.
(4)Change the csproj file to include the following MSBuild snippet:

<OutputPath>..\..\Build\</OutputPath>
<BaseIntermediateOutputPath>..\..\Build\Intermediate\$(AssemblyName)\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>




第四就是下载工具后,还能在工具里面添加插件:



下面的插件在上面提到的页面有下载

 

Add-In Name Description
 Review:  (允许你编辑和管理注释) 
Diff: 显示不同版本之间的相同asembly
SilverlightLoader: 允许浏览页面的结构和下载下来的Silverlight的assemblies
FileDisassembler: 使用堆分解并将信息输出一个文件,适合任何Reflector支持的语言
Reflexil: 允许操作一个已经加载的assembly的和写入硬盘的IL
BamlViewer: 加载BAML resources( wpf)和呈现一个XAML格式
SilverlightBrowser: 加载和显示文件页面上的Silverlight
ComLoader:                        会显示一个COM components清单适合于浏览和转换他们成为脱管理的interop assemblies
SQL2005Browser: 显示,浏览.NET assemblies中存储在SQL Server2005数据
FileGenerator: 使用堆分解并将信息输出一个文件,适合任何Reflector支持的语言
Deblector: 允许你在Reflector中debug处理
Doubler: 为代码产生unit tests, stubs and wrappers
Graph: 图片依赖的draws assembly和IL图片
BizTalkDisassembler: 允许你为BizTalk以前包含的assembly和extract做出一个清单
DependencyStructureMatrix: 允许你创建和浏览信任的structure matrices
CodeSearch: 允许你在被分解的代码中以字符和regular expressions的方式搜索
SequenceViz: 这个绘制Sequence表
AutoDiagrammer: 绘制class表
Xmi4DotNet: 导出一个assembly成XML或UML
AssemblyCollectionSort: 按字母排序当前的Assembly
Enums:   转换big flags和enum查看器
PowerShellLanguage: 呈现输出Windows PowerShell script
DelphiLanguage: 为.Net Reflector扩张C++/CLI language呈现模块
CppCliLanguage: 呈现使用C#代码时候所必须创建的IL主体
ReflectionEmitLanguage: 是一个VS插件能导航任何反编译后的代码元素
Hawkeye: 一个工具允许你debug,Windows Forms中的UI树
ClassView: 显示类定义的情况
CodeModelViewer: 显示选中项目的底层代码模型对象

-----------------works guo----------
posted @ 2007-12-09 02:12  works guo  阅读(1849)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3