`
RednaxelaFX
  • 浏览: 3039757 次
  • 性别: Icon_minigender_1
  • 来自: 海外
社区版块
存档分类
最新评论

.NET的类型层次查看工具,ClassHierarchyViewer,0.3.0.1

    博客分类:
  • .NET
阅读更多
上周为了快速了解一个.NET的库而需要查看其类型层次。假如要在文章中表示一个类型层次,还是用文本比较舒服,截图始终是不方便。Reflector虽然能够显示类型层次,但我无法方便的把显示出来的类型层次转换为文本形式。而且,Reflector在显示基类和派生类的时候都会使用类型的全名,但有时候我只需要看到类型的简单名字。我也找过另外几个工具,例如.NET Framework SDK以前自带的Windows 窗体类查看器(Wincv.exe),但它只显示类型自身的信息以及基类的信息,而不显示派生类的信息,还是不够用。

没找到现成合用的工具,只好自己写一个了。于是就用C#/WinForms写了一个简单的GUI程序,只是用来显示类型层次信息,并且能把类型层次以文本形式复制到剪贴板。

截图一张:

对应这张截图得到的文本表示:
IList<T>
  Collection<T>
  KeyedCollection<TKey, TItem>
  List<T>
  ReadOnlyCollection<T>


===========================================================================

开源形式

该程序采用MIT形式的许可证开放源代码。程序与源码可在本帖附件的压缩包中获得。

运行环境

由于使用了LINQ,这个程序需要.NET Framework 3.5才能正常运行。如果需要移植到.NET Framework 2.0的话,可以使用Mono的System.Core.dll的实现。

===========================================================================

使用方法

可以从命令行提供参数来打开assembly,格式为:
ClassHierarchyViewer <assembly-path>
或者直接启动程序,并通过以下三种方式的任意一种来打开assembly:
1、在文本框中输入assembly的完整名称(Name,Version,Culture,PublicKeyToken),并按回车或点击“Load By Name”按钮;
2、按“Open File...”按钮通过对话框选取assembly;
3、从文件浏览器把assembly拖放到该程序的窗口里。

同一时间只会有一个assembly显示在窗口中。

其它功能应该不言而喻了,我就直接把readme文件的内容帖出来吧:
引用
////////////////////////////////////////////////////////////////

Name: ClassHierarchyViewer
Author: RednaxelaFX (Kris Mok, rednaxela0607@hotmail.com)
Version: 0.3.0.1
Release Date: 2008-09-23

License: MIT style license. See License.txt.

////////////////////////////////////////////////////////////////

Description:

A simple tool that shows the class hierarchy within a given
.NET assembly.

Required Environment:
Windows XP or Vista, with .NET Framework 3.5 or above installed.

////////////////////////////////////////////////////////////////

Usage:

1. Start program from command line:
usage: ClassHierarchyViewer <assembly-path>

- or -

2. Start program from GUI:
Assemblies can be loaded by one of:
  * enter the assembly's full name in the combobox, then click
      "Load By Name" button;
  * enter the assembly's full name in the combobox, and hit
      Enter;
  * Click "Open File..." button, and choose an assembly file;
  * Drag and drop a assembly file from Explorer.

Only one assembly is active at a time.

A few commonly used BCL assemblies' names are added to the
combox already, including:

mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.AddIn, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac
System.Net, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

////////////////////////////////////////////////////////////////

Functions:

The GUI window is divided into 3 major components:

1. Class List Window (on the left)

Displays all types (except "<Module>") in the given assembly,
grouped by their namespaces, sorted by the type's name.
Types that are not visible outside the assembly are marked gray.

2. Class Hierarchy Window (on the upper right)

When a type is selected in the Class List Window, its type
hierarchy will be shown in this window.
The hierarchy shown includes the type itself, its base type (up
to System.Object), and all its derived types.

Checking/unchecking the "Full Name" checkbox will cause this
window to reload, showing types with their simple name/full name.

Clicking "Copy to Clipboard" button will copy the type hierarchy
to the clipboard, in text representaion.

3. Class Member Window (on the lower right)

When a type is selected in the Class Hierarchy Window, its
members will be shown in this window. This does not include
a type's nested types.

Checking/unchecking the "Use Alias" checkbox will cause this
window to reload, showing types with their alias/name.

////////////////////////////////////////////////////////////////

Known Issues:

1. TreeViews flicker when mouse moves over them rapidly.
  Haven't found any solution to this, maybe that's just how
  WinForms behaves.

2. Copying the type hierarchy causes flickering.
  This is because of the way data is loaded: derived types are
  added onto the tree when a node is expanded. To make sure
  derived types are added correctly, the whole tree is expanded
  before its text representation can be gathered. This will be
  improved in later versions with M-V-VM pattern.

3. Properties' getter and setter methods aren't associated with
the properties' nodes.
  Due to the lack of developing time, certain useful functions
  such as this one is not implemented yet. Will be fixed in
  later versions.

4. Doesn't show what interfaces a type implements.
  Same as above. Will be fixed.

5. Cannot load an assembly from GAC just by browsing in the open
file dialog.
  I know. That's why there's an alternative, to load assemblies
  with their full names. Later on I might add a dialog to select
  assemblies from GAC.

////////////////////////////////////////////////////////////////

Note:

The icons used in this program originated from Microsoft Visual
Studio 2008's image libraries, Visual Studio Image Library:
24bit Objects and Objects (WinVista style, .png).


许可证:
引用
The MIT License

Copyright (c) 2008 RednaxelaFX (Kris Mok, rednaxela0607@hotmail.com)

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.


现在这个简陋的程序最大的限制就是无法自如的打开GAC里的assembly,因为在Windows上安装.NET Framework之后,GAC目录默认会被Fusion管理起来,需要通过修改注册表来禁用这个功能才能看到GAC里的assembly的路径。当然,我可以扫描%WINDOWS%\Assembly\下的所有assembly,不过这个功能还没做进来;别的类似程序在扫描GAC时非常慢,所以我不太肯定要不要把这个功能做进来。现在通过强名称一样能打开GAC里的assembly,只是用户会辛苦一点了。预先放在文本框的下拉列表里的名称应该能满足一般使用需要了吧。

如果有什么意见和建议,欢迎提出。有需要请通过站内短信或者电子邮件联系,谢谢 ^ ^
2
0
分享到:
评论
1 楼 hd700 2008-09-24  
强烈支持楼主

相关推荐

    microsoft.netframework.referenceassemblies.net451.1.0.3.nupkg

    Microsoft .NET Framework Reference Assemblies 食用方式:https://blog.csdn.net/IQQQQU/article/details/128284456

    microsoft.netframework.referenceassemblies.net452.1.0.3.nupkg

    Microsoft .NET Framework Reference Assemblies 食用方式:https://blog.csdn.net/IQQQQU/article/details/128284456

    ASP.NET.Maker.v7.0.0.1-Keygen.rar

    ASP.NET.Maker.v7.0.0.1-Keygen 序列号生成器,可以破解ASP.NET.Maker.v7.0.0.1安装后的程序。 ASP.NET Maker 能快速地从数据库连接资料来源中生成一完整的 asp.net程序。支持以下数据库:Microsoft Access, ...

    microsoft.netframework.referenceassemblies.net45.1.0.3.nupkg

    Microsoft .NET Framework Reference Assemblies 食用方式:https://blog.csdn.net/IQQQQU/article/details/128284456

    .NET控件DotNetBarforVS20056.8.0.1

    .NET控件DotNetBarforVS20056.8.0.1.exe

    [.Net 脱壳] .NET Generic Unpacker 1.0.0.1

    This is a program to dump .NET packed applications. Of course no serious .NET protection relies on packing. In fact, this software shows how easily you can unpack a protected assemly. This .NET ...

    小贝程序员生活\jar\lib\com.springsource.net.sf.cglib-2.2.0.jar

    小贝程序员生活\jar\lib\com.springsource.net.sf.cglib-2.2.0.jar 小贝程序员生活\jar\lib\com.springsource.net.sf.cglib-2.2.0.jar 小贝程序员生活\jar\lib\com.springsource.net.sf.cglib-2.2.0.jar

    microsoft.netframework.referenceassemblies.net461.1.0.3.nupkg

    microsoft.netframework.referenceassemblies.net461.1.0.3.nupkg 食用方式:https://blog.csdn.net/IQQQQU/article/details/128284456

    libaio-0.3.93-4.i386.rpm

    如果你是安装MySql,并且你是...我从网站(http://rpm.pbone.net/)上下载了一个llibaio.so.1,结果就是如标题那样的。我找了好多的rpm包,最后我终于找到了一个靠谱的rpm包了。现在我分享出来,希望能够帮上大家的忙。

    libaio-0.3.109-13.el7.x86_64.zip

    相关博客: 《MySQL单机部署》: https://blog.csdn.net/Zhuge_Dan/article/details/106995554 《MySQL集群方案》: https://blog.csdn.net/Zhuge_Dan/article/details/108339965

    Oracle Data Provider for .NET, Managed Driver Beta 11.2.0.3.50

    Managed ODP.NET Beta Now Available ODP.NET, Managed Driver is 100% fully managed. Developers can deploy a single assembly, side by side with other ODP.NET versions easily in a deployment package ...

    网页快速制作软件ASP.NET.Maker.v7.0.0.1

    总的来说,ASP.NET Maker v7.0.0.1 是一个强大的网页制作工具,它降低了创建专业级Web应用的门槛,尤其适合初学者和中小型企业快速构建自己的在线业务平台。通过熟练掌握这款软件,用户可以大大提高网页开发的效率,...

    DsoFramer_V2.3.0.1.rar_DsoFramer vb_DsoFramer_V2.3.0.0_DsoFramer

    控件采用标准互联网协议,支持任意后台Web服务器(iis, domino, webaphere, apache等),任意后台操作系统(win2k, win2003, linux, unix等),以及任意后台编程语言(asp, asp.net, jsp, php, vb.net, c#...

    FastReport.Net 4.0+V2013.2.5_附安装_破解_个人测试程序

    FastReport.Net+V2013.2.5+For+.Net4.0_附安装与破解_个人测试程序 1.首先安装FastReport.Net+V2013.2.5 For Net 4.0 的原始安装文件[FRNetDemo2010.msi] 2.将FastReport.Net+V2013.2.5+For+.Net4.0文件夹中的...

    .net控件包v7.7.0.3

    DevComponents公司推出的".NET控件包v7.7.0.3"就是这样一款集实用性与创新性于一体的工具集合,它包含了49个精心设计的控件,适用于各种类型的.NET应用,尤其在Visual Studio 2008环境下表现出色。 该控件包的核心...

    Agile.Net_Obfuscator_6.4.0.1_Downloadly.ir.rar

    在本文中,我们将深入探讨Agile.Net Obfuscator 6.4.0.1的主要功能、工作原理以及它如何与Delphi开发环境结合使用。 1. **什么是代码混淆** 代码混淆是将源代码转换为难以理解的形式,以增加破解和分析的难度。...

    浏览器生成目录插件 :SmartTOC0.3.16

    下载并解压文件SmartTOC0.3.16.rar--&gt;得到SmartTOC0.3.16,将SmartTOC0.3.16文件夹放到全英文路径下(例如放到桌面)。 Chrome插件安装方式:打开Chrome浏览器,新开一个TAB。 输入:chrome://extensions 并打开 ...

    ikvm-0.40.0.1

    标题“ikvm-0.40.0.1”指的是一个特定版本的IKVM软件,这是一个开源项目,其全称为“Java Virtual Machine for .NET”。IKVM的主要功能是将Java平台上的字节码(.jar文件)转换为.NET Framework可执行的.exe或.dll...

Global site tag (gtag.js) - Google Analytics