Assembly.cs: LoadWithPartialName
[mono.git] / mcs / class / corlib / System.Reflection / Assembly.cs
1 //
2 // System.Reflection/Assembly.cs
3 //
4 // Author:
5 //   Paolo Molaro (lupus@ximian.com)
6 //
7 // (C) 2001 Ximian, Inc.  http://www.ximian.com
8 //
9
10 using System;
11 using System.Security.Policy;
12 using System.Runtime.Serialization;
13 using System.Reflection.Emit;
14 using System.IO;
15 using System.Globalization;
16 using System.Runtime.CompilerServices;
17
18 namespace System.Reflection {
19
20         [Serializable]
21         public class Assembly : System.Reflection.ICustomAttributeProvider,
22                 System.Security.IEvidenceFactory, System.Runtime.Serialization.ISerializable {
23                 private IntPtr _mono_assembly;
24
25                 internal Assembly () {}
26
27                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
28                 private extern string get_code_base ();
29                 
30                 public virtual string CodeBase {
31                         get {
32                                 return get_code_base ();
33                         }
34                 }
35
36                 public virtual string CopiedCodeBase {
37                         get {
38                                 return null;
39                         }
40                 } 
41
42                 public virtual string FullName {
43                         get {
44                                 //
45                                 // FIXME: This is wrong, but it gets us going
46                                 // in the compiler for now
47                                 //
48                                 return CodeBase;
49                         }
50                 }
51
52                 public virtual MethodInfo EntryPoint {
53                         get {
54                                 return null;
55                         }
56                 }
57
58                 public virtual Evidence Evidence {
59                         get {
60                                 return null;
61                         }
62                 }
63
64                 public virtual String Location {
65                         get {
66                                 return null;
67                         }
68                 }
69
70                 public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
71                 {
72                 }
73
74                 public virtual bool IsDefined (Type attributeType, bool inherit)
75                 {
76                         return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
77                 }
78
79                 public virtual object [] GetCustomAttributes (bool inherit)
80                 {
81                         return MonoCustomAttrs.GetCustomAttributes (this, inherit);
82                 }
83
84                 public virtual object [] GetCustomAttributes (Type attributeType, bool inherit)
85                 {
86                         return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
87                 }
88
89                 public virtual FileStream[] GetFiles ()
90                 {
91                         throw new NotImplementedException ();
92                 }
93
94                 public virtual FileStream GetFile (String name)
95                 {
96                         throw new NotImplementedException ();
97                 }
98
99                 public virtual Stream GetManifestResourceStream (String name)
100                 {
101                         throw new NotImplementedException ();
102                 }
103
104                 public virtual Stream GetManifestResourceStream (Type type, String name)
105                 {
106                         throw new NotImplementedException ();
107                 }
108
109                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
110                 public extern Type[] GetTypes (bool exportedOnly);
111                 
112                 public virtual Type[] GetTypes ()
113                 {
114                         return GetTypes (false);
115                 }
116
117                 public virtual Type[] GetExportedTypes ()
118                 {
119                         return GetTypes (true);
120                 }
121
122                 public virtual Type GetType (String name, Boolean throwOnError)
123                 {
124                         return GetType (name, throwOnError, false);
125                 }
126
127                 public virtual Type GetType (String name) {
128                         return GetType (name, false, false);
129                 }
130
131                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
132                 public extern Type GetType (String name, Boolean throwOnError, Boolean ignoreCase);
133                 
134                 public virtual AssemblyName GetName (Boolean copiedName)
135                 {
136                         throw new NotImplementedException ();
137                 }
138
139                 public virtual AssemblyName GetName ()
140                 {
141                         throw new NotImplementedException ();
142                 }
143
144                 public override String ToString ()
145                 {
146                         return GetName ().Name;
147                 }
148
149                 [MonoTODO]
150                 public static String CreateQualifiedName (String assemblyName, String typeName) 
151                 {
152                         return "FIXME: assembly";
153                 }
154
155                 [MonoTODO]
156                 public static String nCreateQualifiedName (String assemblyName, String typeName)
157                 {
158                         return "FIXME: assembly";
159                 }
160
161                 [MonoTODO]
162                 public static Assembly GetAssembly (Type type)
163                 {
164                         throw new NotImplementedException ();
165                 }
166
167                 [MonoTODO]
168                 public Assembly GetSatelliteAssembly (CultureInfo culture)
169                 {
170                         throw new NotImplementedException ();
171                 }
172
173                 public static Assembly LoadFrom (String assemblyFile)
174                 {
175                         return AppDomain.CurrentDomain.Load (assemblyFile);
176                 }
177
178                 public static Assembly Load (String assemblyString)
179                 {
180                         return AppDomain.CurrentDomain.Load (assemblyString);
181                 }
182                 
183                 public static Assembly Load (String assemblyString, Evidence assemblySecurity)
184                 {
185                         return AppDomain.CurrentDomain.Load (assemblyString, assemblySecurity);
186                 }
187
188                 public static Assembly Load (AssemblyName assemblyRef)
189                 {
190                         return AppDomain.CurrentDomain.Load (assemblyRef);
191                 }
192
193                 public static Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
194                 {
195                         return AppDomain.CurrentDomain.Load (assemblyRef, assemblySecurity);
196                 }
197
198                 public static Assembly Load (Byte[] rawAssembly)
199                 {
200                         return AppDomain.CurrentDomain.Load (rawAssembly);
201                 }
202
203                 public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore)
204                 {
205                         return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
206                 }
207
208                 public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore,
209                                              Evidence securityEvidence)
210                 {
211                         return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore, securityEvidence);
212                 }
213
214                 public static Assembly LoadWithPartialName (string partialName)
215                 {
216                         return LoadWithPartialName (partialName, null);
217                 }
218
219                 [MonoTODO]
220                 public static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence)
221                 {
222                         return AppDomain.CurrentDomain.Load (partialName, securityEvidence);
223                 }
224
225
226                 public Object CreateInstance (String typeName) 
227                 {
228                         throw new NotImplementedException ();
229                 }
230
231                 public Object CreateInstance (String typeName, Boolean ignoreCase)
232                 {
233                         throw new NotImplementedException ();
234                 }
235
236                 public Object CreateInstance (String typeName, Boolean ignoreCase,
237                                               BindingFlags bindingAttr, Binder binder,
238                                               Object[] args, CultureInfo culture,
239                                               Object[] activationAttributes)
240                 {
241                         throw new NotImplementedException ();
242                 }
243
244                 public Module[] GetLoadedModules ()
245                 {
246                         throw new NotImplementedException ();
247                 }
248
249                 public Module[] GetModules ()
250                 {
251                         throw new NotImplementedException ();
252                 }
253
254                 public Module GetModule (String name)
255                 {
256                         throw new NotImplementedException ();
257                 }
258
259                 public virtual String[] GetManifestResourceNames ()
260                 {
261                         throw new NotImplementedException ();
262                 }
263
264                 public static Assembly GetExecutingAssembly ()
265                 {
266                         throw new NotImplementedException ();
267                 }
268
269                 public AssemblyName[] GetReferencedAssemblies ()
270                 {
271                         throw new NotImplementedException ();
272                 }
273
274                 public virtual ManifestResourceInfo GetManifestResourceInfo (String resourceName)
275                 {
276                         throw new NotImplementedException ();
277                 }
278         }
279 }