2 // System.Reflection/Assembly.cs
5 // Paolo Molaro (lupus@ximian.com)
7 // (C) 2001 Ximian, Inc. http://www.ximian.com
11 using System.Security.Policy;
12 using System.Runtime.Serialization;
13 using System.Reflection.Emit;
15 using System.Globalization;
16 using System.Runtime.CompilerServices;
18 namespace System.Reflection {
21 public class Assembly : System.Reflection.ICustomAttributeProvider,
22 System.Security.IEvidenceFactory, System.Runtime.Serialization.ISerializable {
23 private IntPtr _mono_assembly;
25 internal Assembly () {}
27 [MethodImplAttribute (MethodImplOptions.InternalCall)]
28 private extern string get_code_base ();
30 public virtual string CodeBase {
32 return get_code_base ();
36 internal virtual string CopiedCodeBase {
42 public virtual string FullName {
45 // FIXME: This is wrong, but it gets us going
46 // in the compiler for now
52 public virtual MethodInfo EntryPoint {
58 public virtual Evidence Evidence {
64 public virtual String Location {
70 public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
74 public virtual bool IsDefined (Type attributeType, bool inherit)
76 return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
79 public virtual object [] GetCustomAttributes (bool inherit)
81 return MonoCustomAttrs.GetCustomAttributes (this, inherit);
84 public virtual object [] GetCustomAttributes (Type attributeType, bool inherit)
86 return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
89 public virtual FileStream[] GetFiles ()
91 throw new NotImplementedException ();
94 public virtual FileStream GetFile (String name)
96 throw new NotImplementedException ();
99 public virtual Stream GetManifestResourceStream (String name)
101 throw new NotImplementedException ();
104 public virtual Stream GetManifestResourceStream (Type type, String name)
106 throw new NotImplementedException ();
109 [MethodImplAttribute (MethodImplOptions.InternalCall)]
110 private extern Type[] GetTypes (bool exportedOnly);
112 public virtual Type[] GetTypes ()
114 return GetTypes (false);
117 public virtual Type[] GetExportedTypes ()
119 return GetTypes (true);
122 public virtual Type GetType (String name, Boolean throwOnError)
124 return GetType (name, throwOnError, false);
127 public virtual Type GetType (String name) {
128 return GetType (name, false, false);
131 [MethodImplAttribute (MethodImplOptions.InternalCall)]
132 public extern Type GetType (String name, Boolean throwOnError, Boolean ignoreCase);
134 [MethodImplAttribute (MethodImplOptions.InternalCall)]
135 static extern void FillName (Assembly ass, AssemblyName aname);
137 public virtual AssemblyName GetName (Boolean copiedName)
139 AssemblyName aname = new AssemblyName ();
140 FillName (this, aname);
144 public virtual AssemblyName GetName ()
146 return GetName (false);
149 public override String ToString ()
151 return GetName ().Name;
155 public static String CreateQualifiedName (String assemblyName, String typeName)
157 return typeName + "," + assemblyName;
160 public static Assembly GetAssembly (Type type)
163 return type.Assembly;
164 throw new ArgumentNullException ("type");
168 public Assembly GetSatelliteAssembly (CultureInfo culture)
170 throw new NotImplementedException ();
173 [MethodImplAttribute (MethodImplOptions.InternalCall)]
174 public extern static Assembly LoadFrom (String assemblyFile);
176 public static Assembly Load (String assemblyString)
178 return AppDomain.CurrentDomain.Load (assemblyString);
181 public static Assembly Load (String assemblyString, Evidence assemblySecurity)
183 return AppDomain.CurrentDomain.Load (assemblyString, assemblySecurity);
186 public static Assembly Load (AssemblyName assemblyRef)
188 return AppDomain.CurrentDomain.Load (assemblyRef);
191 public static Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
193 return AppDomain.CurrentDomain.Load (assemblyRef, assemblySecurity);
196 public static Assembly Load (Byte[] rawAssembly)
198 return AppDomain.CurrentDomain.Load (rawAssembly);
201 public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore)
203 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
206 public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore,
207 Evidence securityEvidence)
209 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore, securityEvidence);
212 public static Assembly LoadWithPartialName (string partialName)
214 return LoadWithPartialName (partialName, null);
218 public static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence)
220 return AppDomain.CurrentDomain.Load (partialName, securityEvidence);
224 public Object CreateInstance (String typeName)
226 return CreateInstance (typeName, false);
229 public Object CreateInstance (String typeName, Boolean ignoreCase)
231 Type t = GetType (typeName, true, ignoreCase);
232 return Activator.CreateInstance (t);
235 public Object CreateInstance (String typeName, Boolean ignoreCase,
236 BindingFlags bindingAttr, Binder binder,
237 Object[] args, CultureInfo culture,
238 Object[] activationAttributes)
240 Type t = GetType (typeName, true, ignoreCase);
241 return Activator.CreateInstance (t, bindingAttr, binder, args, culture, activationAttributes);
244 public Module[] GetLoadedModules ()
246 throw new NotImplementedException ();
249 public Module[] GetModules ()
251 throw new NotImplementedException ();
254 public Module GetModule (String name)
256 throw new NotImplementedException ();
259 public virtual String[] GetManifestResourceNames ()
261 throw new NotImplementedException ();
264 public static Assembly GetExecutingAssembly ()
266 throw new NotImplementedException ();
269 public AssemblyName[] GetReferencedAssemblies ()
271 throw new NotImplementedException ();
274 public virtual ManifestResourceInfo GetManifestResourceInfo (String resourceName)
276 throw new NotImplementedException ();