Assembly.cs 6.2 KB

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