dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Reflection Assembly.c


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/runtime/System/Reflection Assembly.cs,1.24,1.25
Date: Thu, 24 Apr 2003 21:26:19 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Reflection
In directory subversions:/tmp/cvs-serv6758/runtime/System/Reflection

Modified Files:
        Assembly.cs 
Log Message:


Missing functionality in "Assembly".


Index: Assembly.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/runtime/System/Reflection/Assembly.cs,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** Assembly.cs 19 Apr 2003 04:03:04 -0000      1.24
--- Assembly.cs 25 Apr 2003 01:26:17 -0000      1.25
***************
*** 30,38 ****
  using System.Security.Policy;
  using System.Runtime.CompilerServices;
  
! public class Assembly : IClrProgramItem
  #if CONFIG_REFLECTION
        , ICustomAttributeProvider
  #endif
  {
  
--- 30,47 ----
  using System.Security.Policy;
  using System.Runtime.CompilerServices;
+ using System.Runtime.InteropServices;
+ using System.Runtime.Serialization;
+ using System.Configuration.Assemblies;
  
! #if !ECMA_COMPAT
! [ClassInterface(ClassInterfaceType.AutoDual)]
! #endif
! public class Assembly : IClrProgramItem, IEvidenceFactory
  #if CONFIG_REFLECTION
        , ICustomAttributeProvider
  #endif
+ #if !ECMA_COMPAT
+       , ISerializable
+ #endif
  {
  
***************
*** 105,113 ****
  
        // Get the custom attributes associated with this assembly.
!       public Object[] GetCustomAttributes(bool inherit)
                        {
                                return ClrHelpers.GetCustomAttributes(this, 
inherit);
                        }
!       public Object[] GetCustomAttributes(Type type, bool inherit)
                        {
                                return ClrHelpers.GetCustomAttributes(this, 
type, inherit);
--- 114,122 ----
  
        // Get the custom attributes associated with this assembly.
!       public virtual Object[] GetCustomAttributes(bool inherit)
                        {
                                return ClrHelpers.GetCustomAttributes(this, 
inherit);
                        }
!       public virtual Object[] GetCustomAttributes(Type type, bool inherit)
                        {
                                return ClrHelpers.GetCustomAttributes(this, 
type, inherit);
***************
*** 115,119 ****
  
        // Determine if custom attributes are associated with this assembly.
!       public bool IsDefined(Type type, bool inherit)
                        {
                                return ClrHelpers.IsDefined(this, type, 
inherit);
--- 124,128 ----
  
        // Determine if custom attributes are associated with this assembly.
!       public virtual bool IsDefined(Type type, bool inherit)
                        {
                                return ClrHelpers.IsDefined(this, type, 
inherit);
***************
*** 355,379 ****
  
  #if !ECMA_COMPAT
!       public static Assembly LoadWithPartialName (string partialName)
                        {
!                               return LoadWithPartialName (partialName, null);
                        }
  
!       [TODO]
!       public static Assembly LoadWithPartialName (string partialName, 
!                                                                               
                Evidence securityEvidence)
                        {
!                               return LoadFrom(partialName);
                        }
  
!       [TODO]
!       public virtual AssemblyName GetName()
!       {
!               AssemblyName name=new AssemblyName();
!               name.Name=ClrHelpers.GetName(privateData);
!               name.Version=new Version(0,0,0,0);
!               return name;
!       }
! #endif
  
        // Convert this assembly into a string.
--- 364,468 ----
  
  #if !ECMA_COMPAT
! 
!       // Load an assembly using evidence (which we dont' use in
!       // this implemantation).
!       public static Assembly Load(String assemblyString,
!                                                               Evidence 
assemblySecurity)
                        {
!                               return Load(assemblyString, 
GetCallingAssembly());
                        }
  
!       // Load an assembly given an assembly name.
!       public static Assembly Load(AssemblyName assemblyRef)
!                       {
!                               if(assemblyRef == null)
!                               {
!                                       throw new 
ArgumentNullException("assemblyRef");
!                               }
!                               return Load(assemblyRef.FullName, 
GetCallingAssembly());
!                       }
!       public static Assembly Load(AssemblyName assemblyRef,
!                                                               Evidence 
assemblySecurity)
                        {
!                               if(assemblyRef == null)
!                               {
!                                       throw new 
ArgumentNullException("assemblyRef");
!                               }
!                               return Load(assemblyRef.FullName, 
GetCallingAssembly());
                        }
  
!       // Load an assembly from a raw byte image.
!       public static Assembly Load(byte[] rawAssembly)
!                       {
!                               return AppDomain.CurrentDomain.Load
!                                       (rawAssembly, null, null, 
GetCallingAssembly());
!                       }
!       public static Assembly Load(byte[] rawAssembly, byte[] rawSymbolStore)
!                       {
!                               return AppDomain.CurrentDomain.Load
!                                       (rawAssembly, rawSymbolStore, null,
!                                        GetCallingAssembly());
!                       }
!       public static Assembly Load(byte[] rawAssembly, byte[] rawSymbolStore,
!                                                               Evidence 
securityEvidence)
!                       {
!                               return AppDomain.CurrentDomain.Load
!                                       (rawAssembly, rawSymbolStore, 
securityEvidence,
!                                        GetCallingAssembly());
!                       }
! 
!       // Load an assembly from a file.
!       public static Assembly LoadFile(String path)
!                       {
!                               return LoadFrom(path, GetCallingAssembly());
!                       }
!       public static Assembly LoadFile(String path, Evidence securityEvidence)
!                       {
!                               return LoadFrom(path, GetCallingAssembly());
!                       }
!       public static Assembly LoadFrom(String assemblyFile,
!                                                                       
Evidence securityEvidence)
!                       {
!                               return LoadFrom(assemblyFile, 
GetCallingAssembly());
!                       }
!       public static Assembly LoadFrom(String assemblyFile,
!                                                                       
Evidence securityEvidence,
!                                                                       byte[] 
hashValue,
!                                                                       
AssemblyHashAlgorithm hashAlgorithm)
!                       {
!                               return LoadFrom(assemblyFile, 
GetCallingAssembly());
!                       }
! 
!       // Load an assembly using a partial name.
!       public static Assembly LoadWithPartialName(String partialName)
!                       {
!                               return LoadWithPartialName(partialName, 
GetCallingAssembly());
!                       }
!       public static Assembly LoadWithPartialName(String partialName, 
!                                                                               
           Evidence securityEvidence)
!                       {
!                               return LoadWithPartialName(partialName, 
GetCallingAssembly());
!                       }
!       private static Assembly LoadWithPartialName(String partialName,
!                                                                               
                Assembly caller)
!                       {
!                               Assembly assembly;
!                               int error;
!                               if(partialName == null)
!                               {
!                                       throw new 
ArgumentNullException("partialName");
!                               }
!                               assembly = LoadFromName(partialName, out error, 
caller);
!                               if(error == LoadError_OK)
!                               {
!                                       return assembly;
!                               }
!                               else
!                               {
!                                       return null;
!                               }
!                       }
! 
! #endif // !ECMA_COMPAT
  
        // Convert this assembly into a string.
***************
*** 413,416 ****
--- 502,516 ----
                        }
        
+       // Get the escaped code base associated with this assembly.
+       [TODO]
+       public virtual String EscapedCodeBase
+                       {
+                               get
+                               {
+                                       // TODO
+                                       return null;
+                               }
+                       }
+       
        // Get the entry point for this assembly.
        public virtual MethodInfo EntryPoint
***************
*** 445,448 ****
--- 545,560 ----
                        }
  
+       // Get the runtime version that the assembly was compiled against.
+       [ComVisible(false)]
+       public virtual String ImageRuntimeVersion
+                       {
+                               get
+                               {
+                                       return GetImageRuntimeVersion();
+                               }
+                       }
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern private String GetImageRuntimeVersion();
+ 
        // Get the location where this assembly was loaded from.
        [TODO]
***************
*** 483,486 ****
--- 595,717 ----
        // Module resolution event.
        public event ModuleResolveEventHandler ModuleResolve;
+ 
+       // Serialize this object.
+       [TODO]
+       public virtual void GetObjectData(SerializationInfo info,
+                                                                         
StreamingContext context)
+                       {
+                               if(info == null)
+                               {
+                                       throw new ArgumentNullException("info");
+                               }
+                               // TODO
+                       }
+ 
+       // Get the loaded modules within this assembly.  We make no
+       // distinction between loaded and unloaded in this implementation,
+       // because the runtime engine hides the loading of modules.
+       public Module[] GetLoadedModules()
+                       {
+                               return GetModules(false);
+                       }
+       public Module[] GetLoadedModules(bool getResourceModules)
+                       {
+                               return GetModules(getResourceModules);
+                       }
+ 
+       // Get a particular module from within this assembly.
+       public Module GetModule(String name)
+                       {
+                               if(name == null)
+                               {
+                                       throw new ArgumentNullException("name");
+                               }
+                               // TODO
+                               return null;
+                       }
+ 
+       // Get the modules within this assembly.
+       public Module[] GetModules()
+                       {
+                               return GetModules(false);
+                       }
+       [TODO]
+       public Module[] GetModules(bool getResourceModules)
+                       {
+                               // TODO
+                               return new Module [0];
+                       }
+ 
+       // Get the name of this assembly.
+       [TODO]
+       public virtual AssemblyName GetName()
+                       {
+                               AssemblyName name = new AssemblyName();
+                               name.Name = FullName;
+                               name.Version = new Version(0, 0, 0, 0); // TODO
+                               return name;
+                       }
+       public virtual AssemblyName GetName(bool copiedName)
+                       {
+                               // We don't support shadow copies in this 
implementation.
+                               return GetName();
+                       }
+ 
+       // Get a list of the assemblies that are referenced by this one.
+       [TODO]
+       public AssemblyName[] GetReferencedAssemblies()
+                       {
+                               // TODO
+                               return new AssemblyName [0];
+                       }
+ 
+       // Get a satellite resource assembly.
+       public Assembly GetSatelliteAssembly(CultureInfo culture)
+                       {
+                               return GetSatelliteAssembly
+                                       (culture, null, GetCallingAssembly());
+                       }
+       public Assembly GetSatelliteAssembly(CultureInfo culture, Version 
version)
+                       {
+                               return GetSatelliteAssembly
+                                       (culture, version, 
GetCallingAssembly());
+                       }
+       private Assembly GetSatelliteAssembly(CultureInfo culture,
+                                                                               
  Version version,
+                                                                               
  Assembly caller)
+                       {
+                               if(culture == null)
+                               {
+                                       throw new 
ArgumentNullException("culture");
+                               }
+                               String baseName = culture.Name + 
Path.DirectorySeparatorChar +
+                                                                 FullName + 
".resources.dll";
+                               String path = GetSatellitePath(baseName);
+                               if(path == null)
+                               {
+                                       throw new FileNotFoundException
+                                               (String.Format
+                                                       
(_("Reflection_AssemblyFile"), baseName));
+                               }
+                               else
+                               {
+                                       return LoadFrom(path, caller);
+                               }
+                       }
+ 
+       // Load a raw module and attach it to this assembly.
+       public Module LoadModule(String moduleName, byte[] rawModule)
+                       {
+                               return LoadModule(moduleName, rawModule, null);
+                       }
+       public Module LoadModule(String moduleName, byte[] rawModule,
+                                                        byte[] rawSymbolStore)
+                       {
+                               // Raw module loading is not supported in this 
implementation.
+                               // It is too dangerous security-wise.
+                               throw new SecurityException
+                                               (String.Format
+                                                       
(_("Reflection_AssemblySecurity"), moduleName));
+                       }
  
  #endif // CONFIG_REFLECTION && !ECMA_COMPAT





reply via email to

[Prev in Thread] Current Thread [Next in Thread]