BioCore  5.0.0
A Windows .NET microscopy library and application for viewing, editing, and annotating images.
Loading...
Searching...
No Matches
BioCore.Lib Class Reference

Classes

class  ObjectInfo
 
class  TypeInfo
 

Public Member Functions

 Lib (string file)
 
object Invoke (Type type, string name, object o, object[] args)
 
object Invoke (string st, string name, object o, object[] args)
 
object GetProperty (string type, string name, object obj)
 

Public Attributes

Assembly dll
 
Dictionary< string, TypeInfo > Types = new Dictionary<string, TypeInfo>()
 
Dictionary< string, TypeInfo > Objects = new Dictionary<string, TypeInfo>()
 
Dictionary< string, Module > Modules = new Dictionary<string, Module>()
 
Dictionary< string, ConstructorInfo > Constructors = new Dictionary<string, ConstructorInfo>()
 
Dictionary< string, InterfaceMapping > Interfaces = new Dictionary<string, InterfaceMapping>()
 

Detailed Description

Definition at line 35 of file Library.cs.

Constructor & Destructor Documentation

◆ Lib()

BioCore.Lib.Lib ( string file)

Definition at line 155 of file Library.cs.

156 {
157 dll = Assembly.LoadFile(file);
158 Type[] tps = dll.GetExportedTypes();
159 foreach (Type type in tps)
160 {
161 TypeInfo t = new TypeInfo();
162 t.type = type;
163 string s = type.ToString();
164 s = s.Remove(0, s.LastIndexOf('.') + 1);
165 if (type.IsEnum)
166 {
167 GetEnums(t);
168 }
169 GetInterfaces(t);
170 GetConstructors(t);
171 GetProperties(t);
172 GetFields(t);
173 GetMethods(t);
174 GetMembers(t);
175 Types.Add(s, t);
176 }
177 Module[] mds = dll.GetModules();
178 foreach (Module m in mds)
179 {
180 string s = m.ToString();
181 s = s.Remove(0, s.LastIndexOf('.') + 1);
182 Modules.Add(s, m);
183 }
184 }
Dictionary< string, Module > Modules
Definition Library.cs:40
Assembly dll
Definition Library.cs:37
Dictionary< string, TypeInfo > Types
Definition Library.cs:38

Member Function Documentation

◆ GetProperty()

object BioCore.Lib.GetProperty ( string type,
string name,
object obj )

Get the property of the object with the given name

Parameters
typeThe type of the object you want to get the property from.
nameThe name of the property
objThe object you want to get the property from
Returns
The value of the property.

Definition at line 221 of file Library.cs.

222 {
223 Type myType = Types[type].type;
224 PropertyInfo p = myType.GetProperty(name);
225 return p.GetValue(obj);
226 }

◆ Invoke() [1/2]

object BioCore.Lib.Invoke ( string st,
string name,
object o,
object[] args )

It takes a string, a name, an object, and an array of objects, and returns an object

Parameters
stThe name of the type.
nameThe name of the method to invoke.
oThe object to invoke the method on.
argsThe arguments to pass to the method. This array of arguments must match in number, order, and type the parameters of the method to be invoked. If there are no parameters, args must be null.
Returns
The return value of the method.

Definition at line 209 of file Library.cs.

210 {
211 Type t = Types[st].type;
212 return t.InvokeMember(name, BindingFlags.InvokeMethod, null, o, args);
213 }

◆ Invoke() [2/2]

object BioCore.Lib.Invoke ( Type type,
string name,
object o,
object[] args )

It invokes a method on an object

Parameters
TypeThe type of the object you want to invoke the method on.
nameThe name of the method to invoke.
oThe object to invoke the method on.
argsThe arguments to pass to the method. This array of arguments must match in number, order, and type the parameters of the method to be invoked. If there are no parameters, args must be null.
Returns
The return value of the method.

Definition at line 195 of file Library.cs.

196 {
197 return type.InvokeMember(name, BindingFlags.InvokeMethod, null, o, args);
198 }

Member Data Documentation

◆ Constructors

Dictionary<string, ConstructorInfo> BioCore.Lib.Constructors = new Dictionary<string, ConstructorInfo>()

Definition at line 41 of file Library.cs.

◆ dll

Assembly BioCore.Lib.dll

Definition at line 37 of file Library.cs.

◆ Interfaces

Dictionary<string, InterfaceMapping> BioCore.Lib.Interfaces = new Dictionary<string, InterfaceMapping>()

Definition at line 42 of file Library.cs.

◆ Modules

Dictionary<string, Module> BioCore.Lib.Modules = new Dictionary<string, Module>()

Definition at line 40 of file Library.cs.

◆ Objects

Dictionary<string, TypeInfo> BioCore.Lib.Objects = new Dictionary<string, TypeInfo>()

Definition at line 39 of file Library.cs.

◆ Types

Dictionary<string, TypeInfo> BioCore.Lib.Types = new Dictionary<string, TypeInfo>()

Definition at line 38 of file Library.cs.


The documentation for this class was generated from the following file: