64 public Dictionary<string, TypeInfo> Types =
new Dictionary<string, TypeInfo>();
65 public Dictionary<string, TypeInfo> Objects =
new Dictionary<string, TypeInfo>();
66 public Dictionary<string, Module> Modules =
new Dictionary<string, Module>();
67 public Dictionary<string, ConstructorInfo> Constructors =
new Dictionary<string, ConstructorInfo>();
68 public Dictionary<string, InterfaceMapping> Interfaces =
new Dictionary<string, InterfaceMapping>();
82 public Dictionary<string, Enum> Enums =
new Dictionary<string, Enum>();
83 public Dictionary<string, Type> Interfaces =
new Dictionary<string, Type>();
84 public Dictionary<string, ConstructorInfo> Constructors =
new Dictionary<string, ConstructorInfo>();
85 public Dictionary<string, List<MemberInfo>> Members =
new Dictionary<string, List<MemberInfo>>();
86 public Dictionary<string, FieldInfo> Fields =
new Dictionary<string, FieldInfo>();
87 public Dictionary<string, PropertyInfo> Properties =
new Dictionary<string, PropertyInfo>();
88 public Dictionary<string, List<MethodInfo>> Methods =
new Dictionary<string, List<MethodInfo>>();
91 public void AddMember(MemberInfo inf)
93 if(Members.ContainsKey(inf.ToString()))
95 Members[inf.ToString()].Add(inf);
99 List<MemberInfo> l =
new List<MemberInfo>();
101 Members.Add(inf.ToString(), l);
104 public void AddMethod(MethodInfo inf)
106 if (Methods.ContainsKey(inf.ToString()))
108 Methods[inf.ToString()].Add(inf);
112 List<MethodInfo> l =
new List<MethodInfo>();
114 Methods.Add(inf.ToString(), l);
117 public void AddField(FieldInfo inf)
119 Fields.Add(inf.ToString(),inf);
121 public void AddProperty(PropertyInfo inf)
123 Properties.Add(inf.ToString(),inf);
125 public object Invoke(
string name,
object o,
object[] args)
127 return type.InvokeMember(name, BindingFlags.InvokeMethod,
null, o, args);
129 public object GetProperty(
string name,
object obj)
131 PropertyInfo p = type.GetProperty(name);
132 return p.GetValue(obj);
134 public object Instance()
136 return Activator.CreateInstance(type);
138 public override string ToString()
151 public Lib(
string file)
153 dll = Assembly.LoadFile(file);
155 Type[] tps = dll.GetExportedTypes();
156 foreach (Type type
in tps)
160 string s = type.ToString();
161 s = s.Remove(0, s.LastIndexOf(
'.') + 1);
174 Module[] mds = dll.GetModules();
175 foreach (Module m
in mds)
177 string s = m.ToString();
178 s = s.Remove(0, s.LastIndexOf(
'.') + 1);
192 public object Invoke(Type type,
string name,
object o,
object[] args)
194 return type.InvokeMember(name, BindingFlags.InvokeMethod,
null, o, args);
206 public object Invoke(
string st,
string name,
object o,
object[] args)
208 Type t = Types[st].type;
209 return t.InvokeMember(name, BindingFlags.InvokeMethod,
null, o, args);
220 Type myType = Types[type].type;
221 PropertyInfo p = myType.GetProperty(name);
222 return p.GetValue(obj);
228 private void GetEnums(TypeInfo type)
230 Array ar = Enum.GetValues(type.type);
231 foreach (var item
in ar)
233 if(!type.Enums.ContainsKey(item.ToString()))
234 type.Enums.Add(item.ToString(), (Enum)item);
243 private void GetInterfaces(TypeInfo type)
245 Type[] ts = type.type.GetInterfaces();
246 foreach (Type item
in ts)
248 type.Interfaces.Add(item.ToString(), item);
254 private void GetConstructors(TypeInfo type)
256 ConstructorInfo[] ts = type.type.GetConstructors();
257 foreach (ConstructorInfo item
in ts)
259 type.Constructors.Add(item.ToString(), item);
265 private void GetMembers(TypeInfo type)
267 MemberInfo[] ts = type.type.GetMembers();
268 foreach (MemberInfo item
in ts)
270 type.AddMember(item);
276 private void GetProperties(TypeInfo type)
278 PropertyInfo[] ts = type.type.GetProperties();
279 foreach (PropertyInfo item
in ts)
281 type.AddProperty(item);
287 private void GetFields(TypeInfo type)
289 FieldInfo[] ts = type.type.GetFields();
290 foreach (FieldInfo item
in ts)
298 private void GetMethods(TypeInfo type)
300 MethodInfo[] ts = type.type.GetMethods();
301 foreach (MethodInfo item
in ts)
303 type.AddMethod(item);