Boo

Posted on October 14, 2007

Simple script in Boo to quickly dump information about an assembly. Very nice Python-like language for .Net

import System;
import System.Text
import System.Reflection;

#    Because in 2007 Microsoft is still building Sandcastle
class AssemblyStructure():
    file as string
    sb as StringBuilder
    def constructor(file):
        self.file = file
        self.sb = StringBuilder()
    def ToString():
        sb.Append("Assembly: ${file}\n")
        ShowStructure(Assembly.LoadFrom(file))
        sb.Append("\n")
        return sb.ToString()
    def ShowStructure(assembly as Assembly):
        for type in assembly.GetTypes():
            if type.IsClass:
                sb.Append("\tClass ${type.FullName}\n")
                Display("Implements", type.GetInterfaces())
                Display("Property", type.GetProperties())
                Display("Field", type.GetFields())
                Display("Event", type.GetEvents())
                Display("Method", type.GetMethods())
            if type.IsEnum:
                sb.Append("Enum ${type.FullName}\n")
                Display("Fields", type.GetFields())
    def Display(description as string, data):
        for value in data:
            sb.Append("\t\t${description}: ${value}\n")   

assembly = AssemblyStructure("b.dll")
print assembly.ToString()

Filed Under Uncategorized |

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name

Email

Website

Comments

For spam detection purposes, please copy the number 9986 to the field below:

© Copyright 0xDEADBEEFCAFE • Powered by Wordpress • Design by Sebastin.

free web hit counter