2012-04-17 19 views
1

.NETリフレクタの以前のリリースでは、関数内で命令の名前空間を取得できましたが、今はできず、ドキュメントが存在しません。命令の名前空間.NETリフレクタ

レッドゲートの.NETリフレクター6.8.2.5(最後のフリー版)この行は、今働いてなかったが

をinstruction.Value.declaringtype.namespace.ToString私はの名前空間を取得するにはどうすればよいです命令?

Thxを

Private Sub DesassamblerDLL(ByVal strDLLFile As String) 
    Dim serviceProvider As New Reflector.ApplicationManager(Nothing) 
    Dim assemblyManager As Reflector.CodeModel.IAssemblyManager 
    Dim objAssembly As Reflector.CodeModel.IAssembly 
    Dim objMod As Reflector.CodeModel.IModule 
    Dim typeDeclaration As Reflector.CodeModel.ITypeDeclaration 
    Dim methodDeclaration As Reflector.CodeModel.IMethodDeclaration 

    assemblyManager = serviceProvider.GetService(GetType(Reflector.CodeModel.IAssemblyManager)) 
    objAssembly = assemblyManager.LoadFile(strDLLFile) 

    For Each objMod In objAssembly.Modules 
     For Each typeDeclaration In objMod.Types 
      For Each methodDeclaration In typeDeclaration.Methods 
       Dim methodBody As Reflector.CodeModel.IMethodBody = methodDeclaration.Body 
       If Not methodBody Is Nothing Then 
        Dim instruction As Reflector.CodeModel.IInstruction 
        For Each instruction In methodBody.Instructions 
         str = instruction.Value.declaringtype.namespace.ToString 
        Next 
       End If 
      Next 
     Next 
    Next 
End Sub 
+3

どういう意味ですか?それは何をするためのものか?そして、ネームスペースは命令のために何を意味しますか? – svick

+2

RedGateにサポートを依頼してください。 –

+0

命令は、他のDLL /名前空間の内部にある関数への呼び出しです。名前空間は、 "Reflector.CodeModel"のようなフォントにアクセスするためのパスなので、フォントのフルパスが必要です。 – Naster

答えて

0

私はhttp://forums.reflector.net/questions/2226/namespace-of-an-instruction-net-reflectorからクライヴの助けを借りてそれを作りました。

Imports system.Reflection.Emit 

Select Case instruction.Code 
    Case OpCodes.Call.Value, OpCodes.Calli.Value, OpCodes.Callvirt.Value 
     Dim targetMethodReference As Reflector.CodeModel.IMethodReference = instruction.Value 
     Dim method As Reflector.CodeModel.IMethodDeclaration = targetMethodReference.Resolve 
     Dim typeReference As Reflector.CodeModel.ITypeReference = method.DeclaringType 
     ... 
End Select