Mon Jul 1 18:01:49 CEST 2002 Paolo Molaro <lupus@ximian.com>
[mono.git] / mcs / class / corlib / System.Reflection / Assembly.cs
index 9cde9cb50df1c6f3dbfd90362865853040e2c8ed..62c1011e0c8c15510f079aec68293be0b7e0136c 100644 (file)
@@ -33,7 +33,7 @@ namespace System.Reflection {
                        }
                }
 
-               public virtual string CopiedCodeBase {
+               internal virtual string CopiedCodeBase {
                        get {
                                return null;
                        }
@@ -106,14 +106,17 @@ namespace System.Reflection {
                        throw new NotImplementedException ();
                }
 
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               private extern Type[] GetTypes (bool exportedOnly);
+               
                public virtual Type[] GetTypes ()
                {
-                       throw new NotImplementedException ();
+                       return GetTypes (false);
                }
 
                public virtual Type[] GetExportedTypes ()
                {
-                       throw new NotImplementedException ();
+                       return GetTypes (true);
                }
 
                public virtual Type GetType (String name, Boolean throwOnError)
@@ -128,14 +131,19 @@ namespace System.Reflection {
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                public extern Type GetType (String name, Boolean throwOnError, Boolean ignoreCase);
                
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               static extern void FillName (Assembly ass, AssemblyName aname);
+               
                public virtual AssemblyName GetName (Boolean copiedName)
                {
-                       throw new NotImplementedException ();
+                       AssemblyName aname = new AssemblyName ();
+                       FillName (this, aname);
+                       return aname;
                }
 
                public virtual AssemblyName GetName ()
                {
-                       throw new NotImplementedException ();
+                       return GetName (false);
                }
 
                public override String ToString ()
@@ -146,19 +154,14 @@ namespace System.Reflection {
                [MonoTODO]
                public static String CreateQualifiedName (String assemblyName, String typeName) 
                {
-                       return "FIXME: assembly";
+                       return typeName + "," + assemblyName;
                }
 
-               [MonoTODO]
-               public static String nCreateQualifiedName (String assemblyName, String typeName)
-               {
-                       return "FIXME: assembly";
-               }
-
-               [MonoTODO]
                public static Assembly GetAssembly (Type type)
                {
-                       throw new NotImplementedException ();
+                       if (type != null)
+                               return type.Assembly;
+                       throw new ArgumentNullException ("type");
                }
 
                [MonoTODO]
@@ -167,10 +170,8 @@ namespace System.Reflection {
                        throw new NotImplementedException ();
                }
 
-               public static Assembly LoadFrom (String assemblyFile)
-               {
-                       return AppDomain.CurrentDomain.Load (assemblyFile);
-               }
+               [MethodImplAttribute (MethodImplOptions.InternalCall)]
+               public extern static Assembly LoadFrom (String assemblyFile);
 
                public static Assembly Load (String assemblyString)
                {
@@ -208,14 +209,27 @@ namespace System.Reflection {
                        return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore, securityEvidence);
                }
 
+               public static Assembly LoadWithPartialName (string partialName)
+               {
+                       return LoadWithPartialName (partialName, null);
+               }
+
+               [MonoTODO]
+               public static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence)
+               {
+                       return AppDomain.CurrentDomain.Load (partialName, securityEvidence);
+               }
+
+
                public Object CreateInstance (String typeName) 
                {
-                       throw new NotImplementedException ();
+                       return CreateInstance (typeName, false);
                }
 
                public Object CreateInstance (String typeName, Boolean ignoreCase)
                {
-                       throw new NotImplementedException ();
+                       Type t = GetType (typeName, true, ignoreCase);
+                       return Activator.CreateInstance (t);
                }
 
                public Object CreateInstance (String typeName, Boolean ignoreCase,
@@ -223,7 +237,8 @@ namespace System.Reflection {
                                              Object[] args, CultureInfo culture,
                                              Object[] activationAttributes)
                {
-                       throw new NotImplementedException ();
+                       Type t = GetType (typeName, true, ignoreCase);
+                       return Activator.CreateInstance (t, bindingAttr, binder, args, culture, activationAttributes);
                }
 
                public Module[] GetLoadedModules ()
@@ -241,7 +256,7 @@ namespace System.Reflection {
                        throw new NotImplementedException ();
                }
 
-               public String[] GetManifestResourceNames ()
+               public virtual String[] GetManifestResourceNames ()
                {
                        throw new NotImplementedException ();
                }
@@ -256,7 +271,7 @@ namespace System.Reflection {
                        throw new NotImplementedException ();
                }
 
-               public ManifestResourceInfo GetManifestResourceInfo (String resourceName)
+               public virtual ManifestResourceInfo GetManifestResourceInfo (String resourceName)
                {
                        throw new NotImplementedException ();
                }