BioImager  3.9.1
A .NET microscopy imaging library. Supports various microscopes by using imported libraries & GUI automation. Supported libraries include PriorĀ® & ZeissĀ® & all devices supported by Micromanager 2.0 and python-microscope.
Loading...
Searching...
No Matches
BioImager.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, TypeInfoTypes = new Dictionary<string, TypeInfo>()
 
Dictionary< string, TypeInfoObjects = 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 61 of file Library.cs.

Constructor & Destructor Documentation

◆ Lib()

BioImager.Lib.Lib ( string  file)

Definition at line 151 of file Library.cs.

152 {
153 dll = Assembly.LoadFile(file);
154 //Assembly.ReflectionOnlyLoad
155 Type[] tps = dll.GetExportedTypes();
156 foreach (Type type in tps)
157 {
158 TypeInfo t = new TypeInfo();
159 t.type = type;
160 string s = type.ToString();
161 s = s.Remove(0, s.LastIndexOf('.') + 1);
162 if (type.IsEnum)
163 {
164 GetEnums(t);
165 }
166 GetInterfaces(t);
167 GetConstructors(t);
168 GetProperties(t);
169 GetFields(t);
170 GetMethods(t);
171 GetMembers(t);
172 Types.Add(s,t);
173 }
174 Module[] mds = dll.GetModules();
175 foreach (Module m in mds)
176 {
177 string s = m.ToString();
178 s = s.Remove(0, s.LastIndexOf('.') + 1);
179 Modules.Add(s, m);
180 }
181 }

Member Function Documentation

◆ GetProperty()

object BioImager.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 218 of file Library.cs.

219 {
220 Type myType = Types[type].type;
221 PropertyInfo p = myType.GetProperty(name);
222 return p.GetValue(obj);
223 }

◆ Invoke() [1/2]

object BioImager.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 206 of file Library.cs.

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

◆ Invoke() [2/2]

object BioImager.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 192 of file Library.cs.

193 {
194 return type.InvokeMember(name, BindingFlags.InvokeMethod, null, o, args);
195 }

Member Data Documentation

◆ Constructors

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

Definition at line 67 of file Library.cs.

◆ dll

Assembly BioImager.Lib.dll

Definition at line 63 of file Library.cs.

◆ Interfaces

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

Definition at line 68 of file Library.cs.

◆ Modules

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

Definition at line 66 of file Library.cs.

◆ Objects

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

Definition at line 65 of file Library.cs.

◆ Types

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

Definition at line 64 of file Library.cs.


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