Exemple #1
0
        // Builds the list of Dependencies for the Assembly Manifest located in the
        // file ``name''.
        //
        // If ``name'' couldn't be loaded, an exception is thrown as the manifest
        // file doesn't exist or is invalid.  If one of ``names'' dependency's
        // can't be loaded, an exception is not thrown; instead, the
        // IAssemblyInfo object returned will hold exception information.
        //
        internal AssemblyDependencies(string name, LoadAssemblyInfo cai)
        {
            AssemblyRef ar = null;

            m_load = LoadAssembly.CreateLoader(cai);
            try
            {
                Trace.WriteLine("Name: " + name);

                AssemblyName an = m_load.LoadAssemblyName(name);

                Trace.WriteLine("assembly name: " + an.Name);
                Trace.WriteLine("assembly full name: " + an.FullName);

                ar = m_load.LoadAssemblyFrom(an);

                Trace.WriteLine("Successfully loaded assembly.");
            }
            catch (Exception e)
            {
                Trace.WriteLine("m_load.LoadAssemblyFrom threw an exception:\n  " +
                                e.ToString());

                /*
                 * If ``m_load.LoadAssemblyFrom'' throws an exception, we want
                 * our caller to get the exception.  However, since this is
                 * the constructor, we need to clean up any allocated resources --
                 * in this case, the resouces of the LoadAssembly object.
                 */
                m_load.Dispose();
                throw e;
            }

            m_name = ar.FullName;

            IList search = new ArrayList();

            m_alAssemInfo = new ArrayList();

            // Add the top-level object, the Assembly containing the manifest.
            // ``search'' will contain any Assemblies that the added object
            // references.
            m_map.Add(m_name, new AssemblyInfo(ar, search, m_alAssemInfo));

            // Get all referenced Assemblies.
            _traverse(search);
        }
Exemple #2
0
        // Create a LoadAssembly object based on ``i''.
        //
        // If ``i.LoadAs()'' doesn't return a value from the AssemblyLoadAs
        // enumeration, then an exception is thrown.
        internal static LoadAssembly CreateLoader(LoadAssemblyInfo i)
        {
            Trace.WriteLine("Creating Assembly Loader for:");
            Trace.WriteLine("  LoadAs: " + i.LoadAs().ToString());
            Trace.WriteLine("  AppBasePath: " + i.AppPath());
            Trace.WriteLine("  RelativeSearchPath: " + i.RelPath());

            _creator c = (_creator)m_tbl[i.LoadAs()];

            if (c == null)
            {
                throw
                    new Exception("internal error: Invalid AssemblyLoadAs specified");
            }

            return(c(i));
        }
Exemple #3
0
 private static LoadAssembly _create_custom_get(LoadAssemblyInfo cai)
 {
     return(new LoadCustomGetAssembly(cai));
 }
Exemple #4
0
 private static LoadAssembly _create_default(LoadAssemblyInfo cai)
 {
     return(new LoadDefaultAssembly());
 }
Exemple #5
0
 internal LoadCustomGetAssembly(LoadAssemblyInfo i)
     : base(i)
 {
 }
Exemple #6
0
 internal LoadCustomAssembly(LoadAssemblyInfo i)
 {
     m_info = i;
 }