-
Notifications
You must be signed in to change notification settings - Fork 242
Expand file tree
/
Copy pathFrameworkClrBase.cs
More file actions
executable file
·111 lines (87 loc) · 2.69 KB
/
Copy pathFrameworkClrBase.cs
File metadata and controls
executable file
·111 lines (87 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#if !NETFX_CORE || DOTNET_CORE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace MoonSharp.Interpreter.Compatibility.Frameworks
{
abstract class FrameworkClrBase : FrameworkReflectionBase
{
BindingFlags BINDINGFLAGS_MEMBER = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.FlattenHierarchy;
BindingFlags BINDINGFLAGS_INNERCLASS = BindingFlags.Public | BindingFlags.NonPublic;
public override MethodInfo GetAddMethod(EventInfo ei)
{
return ei.GetAddMethod(true);
}
public override ConstructorInfo[] GetConstructors(Type type)
{
return GetTypeInfoFromType(type).GetConstructors(BINDINGFLAGS_MEMBER);
}
public override EventInfo[] GetEvents(Type type)
{
return GetTypeInfoFromType(type).GetEvents(BINDINGFLAGS_MEMBER);
}
public override FieldInfo[] GetFields(Type type)
{
return GetTypeInfoFromType(type).GetFields(BINDINGFLAGS_MEMBER);
}
public override Type[] GetGenericArguments(Type type)
{
return GetTypeInfoFromType(type).GetGenericArguments();
}
public override MethodInfo GetGetMethod(PropertyInfo pi)
{
return pi.GetGetMethod(true);
}
public override Type[] GetInterfaces(Type t)
{
return GetTypeInfoFromType(t).GetInterfaces();
}
public override MethodInfo GetMethod(Type type, string name)
{
return GetTypeInfoFromType(type).GetMethod(name);
}
public override MethodInfo[] GetMethods(Type type)
{
return GetTypeInfoFromType(type).GetMethods(BINDINGFLAGS_MEMBER);
}
public override Type[] GetNestedTypes(Type type)
{
return GetTypeInfoFromType(type).GetNestedTypes(BINDINGFLAGS_INNERCLASS);
}
public override PropertyInfo[] GetProperties(Type type)
{
return GetTypeInfoFromType(type).GetProperties(BINDINGFLAGS_MEMBER);
}
public override PropertyInfo GetProperty(Type type, string name)
{
return GetTypeInfoFromType(type).GetProperty(name);
}
public override MethodInfo GetRemoveMethod(EventInfo ei)
{
return ei.GetRemoveMethod(true);
}
public override MethodInfo GetSetMethod(PropertyInfo pi)
{
return pi.GetSetMethod(true);
}
public override bool IsAssignableFrom(Type current, Type toCompare)
{
return GetTypeInfoFromType(current).IsAssignableFrom(toCompare);
}
public override bool IsInstanceOfType(Type t, object o)
{
return GetTypeInfoFromType(t).IsInstanceOfType(o);
}
public override MethodInfo GetMethod(Type resourcesType, string name, Type[] types)
{
return GetTypeInfoFromType(resourcesType).GetMethod(name, types);
}
public override Type[] GetAssemblyTypes(Assembly asm)
{
return asm.GetTypes();
}
}
}
#endif