VB.net在从base64字符串解码后调用dll并加载它们
我试图在从base64字符串解码后调用dll并加载它们。 但是,我不知道如何完成此代码:VB.net在从base64字符串解码后调用dll并加载它们,vb.net,Vb.net,我试图在从base64字符串解码后调用dll并加载它们。 但是,我不知道如何完成此代码: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Reflection.Assembly.Load(crypt()) End Sub Public Function crypt() As Byte() Return XO
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Reflection.Assembly.Load(crypt())
End Sub
Public Function crypt() As Byte()
Return XORDcrypt(Convert.FromBase64String("Base64 String "), "david")
End Function
dll的原始调用
= ClassLibrary1.A.main()
我想您需要这样的东西,使用反射调用main方法
Imports System.Reflection
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Load the assembly
Dim assm As Assembly = Reflection.Assembly.Load(crypt())
' Get the type description for the ClassLibrary1.A class
Dim objType As Type = assm.GetType("ClassLibrary1.A")
' Create an instance of ClassLibrary1.A, using the default constructor
Dim obj As Object = Activator.CreateInstance(objType)
' Get the method info for the "main" method with no parameters
Dim methInfo As MethodInfo = objType.GetMethod("main")
' Call the main method
methInfo.Invoke(obj, Nothing)
End Sub
@大卫·斯旺森,你有错吗?你的代码现在看起来是什么样子?如何编写这样的代码基本的是什么???@DavidP.Swanson我已经对代码进行了注释,以展示它如何更好地工作。