home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2005 June (DVD) / DPPRO0605DVD.iso / dotNETSDK / SETUP.EXE / netfxsd1.cab / FL_assemblyref_cs________.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Encoding:
Text File  |  2001-06-26  |  1.8 KB  |  64 lines

  1. /**
  2.  * Cross-AppDomain Assembly References.
  3.  *
  4.  * @author  Jonathan Pryor
  5.  */
  6.  
  7. namespace ADepends
  8.   {
  9.   using System;
  10.   using System.Reflection;
  11.   using System.Diagnostics;
  12.  
  13.   /**
  14.    * A "reference" to an Assembly loaded into another AppDomain.
  15.    *
  16.    * This class must be a MarshalByRefObject, as attempting to pass an
  17.    * Assembly between AppDomains causes "File not found" exceptions.
  18.    *
  19.    * This should attempt to mimic the interface exposed by the
  20.    * System.Reflection.Assembly class as much as is feasable.
  21.    */
  22.   internal class AssemblyRef : MarshalByRefObject
  23.     {
  24.     /** The Assembly we're interested in. */
  25.     private Assembly m_a;
  26.  
  27.     /** Load the Assembly referred to by ``an'' into the current AppDomain. */
  28.     public void Load (AssemblyName an)
  29.       {
  30.       Trace.WriteLine ("AR: Loading Assembly: " + an.FullName);
  31.       m_a = Assembly.Load (an);
  32.       }
  33.  
  34.     /** 
  35.      * Return an array of ModuleInfo objects, which provide information
  36.      * for each Module loaded into the wrapped Assembly.
  37.      */
  38.     public ModuleInfo[] GetModules ()
  39.       {Module[] m = m_a.GetModules ();
  40.       ModuleInfo[] r = new ModuleInfo[m.Length];
  41.       for (int i = 0; i < m.Length; i++)
  42.         r[i] = new ModuleInfo(m[i]);
  43.       return r;}
  44.  
  45.     /** Get the AssemblyName of the wrapped Assembly. */
  46.     public AssemblyName GetName ()
  47.       {return m_a.GetName();}
  48.  
  49.     /** Get the AssemblyName's that the wrapped Assembly is dependant on. */
  50.     public AssemblyName[] GetReferencedAssemblies ()
  51.       {return m_a.GetReferencedAssemblies ();}
  52.  
  53.     /** Where the Assembly is located. */
  54.     public string CodeBase
  55.       {get {return m_a.CodeBase;}}
  56.  
  57.     /** The Full Name of the Assembly. */
  58.     public string FullName
  59.       {get {return m_a.FullName;}}
  60.  
  61.     } /* class AssemblyRef */
  62.   } /* namespace ADepends */
  63.  
  64.