其他
net反射
1.1 查找dll文件
using System.Reflection;
Assembly.Load()
Assembly.LoadFrom()
Assembly.LoadFile()
Load需要把dll放到程序当前路径加载,也可以读取字符串形式。LoadFrom需要写全路径,如果test1.dll引用了test2.dll,同时也会加载test2.dll进来。LoadFile不会加载test2.dll。
Assembly assembly1 = Assembly.Load("DllTest");
Assembly assembly2 = Assembly.LoadFile(@"C:\Users\Administrator\Desktop\c#\learn\reflection2\DllTest\bin\Release\DllTest.dll");
Assembly assembly3 = Assembly.LoadFrom(@"C:\Users\Administrator\Desktop\c#\learn\reflection2\DllTest\bin\Release\DllTest.dll");
Assembly assembly4 = Assembly.LoadFrom("DllTest.dll");
1.2 调用构造函数
首先写一个DllTest.dll
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DllTest
{
public class Class1
{
public Class1()
{
Console.WriteLine("no params");
}
public Class1(string name)
{
Console.WriteLine($"have params value is {name}");
}
}
}
前面我们已经加载了dll文件,但是可能会存在多个类,所以我们要获取指定类型。
Type type = assembly.GetType("DllTest.Class1");
然后动态的实例化对象
Object obj = Activator.CreateInstance(type);
调用参数构造方法
Object obj = Activator.CreateInstance(type,new Object[] {"test"});
如何调用私有的构造函数
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DllTest
{
public class Class1
{
private Class1()
{
Console.WriteLine("no params");
}
public Class1(string name)
{
Console.WriteLine($"have params value is {name}");
}
}
}
在CreateInstance方法第二个参数设置为true即可
Assembly assembly = Assembly.LoadFrom("DllTest.dll");
Type type = assembly.GetType("DllTest.Class1");
Object obj = Activator.CreateInstance(type,true);
1.3 查找所有类,构造方法和参数
很多时候我们得到一个dll文件但是不知道里面存在哪些类 我们在DllTest.dll再创建一个类。
Assembly assembly = Assembly.LoadFrom("DllTest.dll");
foreach(var all_type in assembly.GetTypes())
{
Console.WriteLine(all_type.Name);
}
Type type = assembly.GetType("DllTest.Class1");
foreach(var all_cons in type.GetConstructors())
{
Console.WriteLine(all_cons);
}
如果我们要获取构造方法里面的参数
Assembly assembly = Assembly.LoadFrom("DllTest.dll");
foreach(var all_type in assembly.GetTypes())
{
Console.WriteLine("类:"+all_type.Name);
}
Type type = assembly.GetType("DllTest.Class1");
foreach(var all_cons in type.GetConstructors())
{
Console.WriteLine("构造方法:"+all_cons);
foreach(var param in all_cons.GetParameters())
{
Console.WriteLine("所有参数:"+param.Name);
}
}
static void Main(string[] args)
{
Assembly assembly = Assembly.LoadFrom("DllTest.dll");
foreach(var all_type in assembly.GetTypes())
{
Console.WriteLine("类:"+all_type.Name);
}
Type type = assembly.GetType("DllTest.Class1");
foreach(var all_cons in type.GetConstructors(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
{
Console.WriteLine("构造方法:"+all_cons);
foreach(var param in all_cons.GetParameters())
{
Console.WriteLine("所有参数:"+param.Name);
}
}
}
1.4 调用方法
在DllTest添加一个普通方法和一个私有方法
public void TestMethod()
{
Console.WriteLine("TestMethod");
}
先获取所有方法
var methods = type.GetMethods(BindingFlags.Instance|BindingFlags.Public|BindingFlags.NonPublic);
foreach(var method in methods)
{
Console.WriteLine(method);
Console.WriteLine(method.Attributes);
}
可以看到TetMethod方法为public,TestMethod2方法为private。
调用TestMethod方法,就算我们知道这个方法里面没有参数但是还是要new一个空数组,如果有参数写进去即可。
var method = type.GetMethod("TestMethod");
method.Invoke(obj,new object[] {});
调用TestMethod2方法。
var method = type.GetMethod("TestMethod2",BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance);
method.Invoke(obj,new object[] {});
1.5 调用泛型方法
先在DllTest添加两个泛型方法
public void Test<T>()
{
Console.WriteLine("Test");
}
public void Test2<T>(string name)
{
Console.WriteLine($"name is:{name}");
}
var method = type.GetMethod("Test"); //获取方法
var genericMethod = method.MakeGenericMethod(new Type[] {typeof(int)}); //指定泛型参数类型(前面的T)
genericMethod.Invoke(obj, new object[] { });
有参数
var method = type.GetMethod("Test2");
var genericMethod = method.MakeGenericMethod(new Type[] {typeof(string)});
genericMethod.Invoke(obj, new object[] {"jjjj"});
1.6 操作属性
DllTest创建一个Pro类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DllTest
{
public class Pro
{
public string name { get; set; }
public int num { get; set; }
}
}
先获取所有属性
Assembly assembly = Assembly.LoadFrom("DllTest.dll");
Type type = assembly.GetType("DllTest.Pro");
object obj = Activator.CreateInstance(type);
foreach(var property in type.GetProperties())
{
Console.WriteLine(property.Name);
}
设置属性和获取属性
Assembly assembly = Assembly.LoadFrom("DllTest.dll");
Type type = assembly.GetType("DllTest.Pro");
object obj = Activator.CreateInstance(type);
foreach(var property in type.GetProperties())
{
//Console.WriteLine(property.Name);
if (property.Name.Equals("name"))
{
property.SetValue(obj, "zhangsan");
}else if (property.Name.Equals("num"))
{
property.SetValue(obj, 123123);
}
Console.WriteLine(property.GetValue(obj));
}
1.7 利用
DllTest添加TestCalc类
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace DllTest
{
public class TestCalc
{
public static void Start()
{
Process p = new Process();
p.StartInfo.FileName = "c:\\windows\\system32\\calc.exe";
p.Start();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace reflection2
{
internal class Program
{
static void Main(string[] args)
{
Assembly assembly = Assembly.LoadFrom("DllTest.dll");
Type type = assembly.GetType("DllTest.TestCalc");
var method = type.GetMethod("Start");
method.Invoke(type,null);
}
}
前面我们说了Assembly.Load()
可以从string类型加载程序集。新建testcalc项目
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace testcalc
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("test");
}
}
public class Strat
{
public static void run()
{
Process p = new Process();
p.StartInfo.FileName = "c:\\windows\\system32\\calc.exe";
p.Start();
}
}
}
然后使用File.ReadAllBytes
讲testcalc.exe转换为string类型
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace readCalc
{
internal class Program
{
static void Main(string[] args)
{
byte[] buffer = File.ReadAllBytes("testcalc.exe");
string base64str = Convert.ToBase64String(buffer);
Console.WriteLine(base64str);
}
}
}
结果
TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABQRQAATAEDAI+UC8QAAAAAAAAAAOAAIgALATAAAAgAAAAIAAAAAAAAsicAAAAgAAAAQAAAAABAAAAgAAAAAgAABAAAAAAAAAAEAAAAAAAAAACAAAAAAgAAAAAAAAMAQIUAABAAABAAAAAAEAAAEAAAAAAAABAAAAAAAAAAAAAAAF4nAABPAAAAAEAAALwFAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAwAAACwJgAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAACAAAAAAAAAAAAAAACCAAAEgAAAAAAAAAAAAAAC50ZXh0AAAAuAcAAAAgAAAACAAAAAIAAAAAAAAAAAAAAAAAACAAAGAucnNyYwAAALwFAAAAQAAAAAYAAAAKAAAAAAAAAAAAAAAAAABAAABALnJlbG9jAAAMAAAAAGAAAAACAAAAEAAAAAAAAAAAAAAAAAAAQAAAQgAAAAAAAAAAAAAAAAAAAACSJwAAAAAAAEgAAAACAAUAjCAAACQGAAABAAAAAQAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC5yAQAAcCgOAAAKKh4CKA8AAAoqcnMQAAAKJW8RAAAKcgsAAHBvEgAACm8TAAAKJioeAigPAAAKKgAAAEJTSkIBAAEAAAAAAAwAAAB2Mi4wLjUwNzI3AAAAAAUAbAAAABwCAAAjfgAAiAIAAGQCAAAjU3RyaW5ncwAAAADsBAAASAAAACNVUwA0BQAAEAAAACNHVUlEAAAAR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ZXNzPSJmYWxzZSIvPg0KICAgICAgPC9yZXF1ZXN0ZWRQcml2aWxlZ2VzPg0KICAgIDwvc2VjdXJpdHk+DQogIDwvdHJ1c3RJbmZvPg0KPC9hc3NlbWJseT4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAMAAAAtDcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
然后再使用Assembly.Load
加载string反射调用Strat类的run方法
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace Loader
{
internal class Program
{
static void Main(string[] args)
{
string base64str = "TVqQAAMAAAAEAAAA//8AAL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c3RJbmZvPg0KPC9hc3NlbWJseT4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAMAAAAtDcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
byte[] buffer = Convert.FromBase64String(base64str);
Assembly assembly = Assembly.Load(buffer);
Type type = assembly.GetType("testcalc.Strat");
MethodInfo method = type.GetMethod("run");
Object obj = assembly.CreateInstance(method.Name);
method.Invoke(obj, new object[] { });
}
}
}
加下方wx,拉你一起进群学习
往期推荐