29
29
using System.Collections;
30
using System.Collections.Generic;
31
33
namespace Mono.Addins.Database
36
/// An assembly reflector
39
/// This interface can be implemented to provide a custom method for getting information about assemblies.
33
41
public interface IAssemblyReflector
44
/// Called to initialize the assembly reflector
46
/// <param name='locator'>
47
/// IAssemblyLocator instance which can be used to locate referenced assemblies.
35
49
void Initialize (IAssemblyLocator locator);
52
/// Gets a list of custom attributes
55
/// The custom attributes.
57
/// <param name='obj'>
58
/// An assembly, class or class member
60
/// <param name='type'>
61
/// Type of the attribute to be returned. It will always be one of the attribute types
62
/// defined in Mono.Addins.
64
/// <param name='inherit'>
65
/// 'true' if inherited attributes must be returned
37
67
object[] GetCustomAttributes (object obj, Type type, bool inherit);
70
/// Gets a list of custom attributes
75
/// <param name='obj'>
76
/// An assembly, class or class member
78
/// <param name='type'>
79
/// Base type of the attribute to be returned
81
/// <param name='inherit'>
82
/// 'true' if inherited attributes must be returned
84
List<CustomAttribute> GetRawCustomAttributes (object obj, Type type, bool inherit);
87
/// Loads an assembly.
90
/// The loaded assembly
92
/// <param name='file'>
93
/// Path of the assembly.
39
95
object LoadAssembly (string file);
98
/// Loads the assembly specified in an assembly reference
103
/// <param name='asmReference'>
104
/// An assembly reference
40
106
object LoadAssemblyFromReference (object asmReference);
109
/// Gets the names of all resources embedded in an assembly
112
/// The names of the resources
114
/// <param name='asm'>
117
string[] GetResourceNames (object asm);
120
/// Gets the data stream of a resource
125
/// <param name='asm'>
128
/// <param name='resourceName'>
129
/// The name of a resource
131
Stream GetResourceStream (object asm, string resourceName);
134
/// Gets all types defined in an assembly
139
/// <param name='asm'>
41
142
IEnumerable GetAssemblyTypes (object asm);
145
/// Gets all assembly references of an assembly
148
/// A list of assembly references
150
/// <param name='asm'>
42
153
IEnumerable GetAssemblyReferences (object asm);
156
/// Looks for a type in an assembly
161
/// <param name='asm'>
164
/// <param name='typeName'>
44
167
object GetType (object asm, string typeName);
171
/// Gets a custom attribute
174
/// The custom attribute.
176
/// <param name='obj'>
177
/// An assembly, class or class member
179
/// <param name='type'>
180
/// Base type of the attribute to be returned. It will always be one of the attribute types
181
/// defined in Mono.Addins.
183
/// <param name='inherit'>
184
/// 'true' if inherited attributes must be returned
45
186
object GetCustomAttribute (object obj, Type type, bool inherit);
189
/// Gets the name of a type (not including namespace)
194
/// <param name='type'>
46
197
string GetTypeName (object type);
200
/// Gets the full name of a type (including namespace)
203
/// The full name of the type
205
/// <param name='type'>
47
208
string GetTypeFullName (object type);
211
/// Gets the assembly qualified name of a type
214
/// The assembly qualified type name
216
/// <param name='type'>
48
219
string GetTypeAssemblyQualifiedName (object type);
222
/// Gets a list of all base types (including interfaces) of a type
225
/// An enumeration of the full name of all base types of the type
227
/// <param name='type'>
49
230
IEnumerable GetBaseTypeFullNameList (object type);
233
/// Checks if a type is assignable to another type
236
/// 'true' if the type is assignable
238
/// <param name='baseType'>
239
/// Expected base type.
241
/// <param name='type'>
50
244
bool TypeIsAssignableFrom (object baseType, object type);
247
/// Gets the fields of a type
252
/// <param name='type'>
52
255
IEnumerable GetFields (object type);
258
/// Gets the name of a field.
263
/// <param name='field'>
53
266
string GetFieldName (object field);
269
/// Gets the full name of the type of a field
272
/// The full type name
274
/// <param name='field'>
54
277
string GetFieldTypeFullName (object field);
281
/// Allows finding assemblies in the file system
57
283
public interface IAssemblyLocator
286
/// Locates an assembly
289
/// The full path to the assembly, or null if not found
291
/// <param name='fullName'>
292
/// Full name of the assembly
59
294
string GetAssemblyLocation (string fullName);
298
/// A custom attribute
300
public class CustomAttribute: Dictionary<string,string>
305
/// Full name of the type of the custom attribute
307
public string TypeName {
308
get { return typeName; }
309
set { typeName = value; }