// Create the window. No assemblies will be displayed. public DependenciesForm(LoadAssemblyInfo lai) { m_lai = new LoadAssemblyInfo(); m_lai.LoadAs(lai.LoadAs()); m_lai.AppPath(lai.AppPath()); m_lai.RelPath(lai.RelPath()); InitializeComponent(); }
// Creates the window with a tree view of dependant assemblies/files. public DependenciesForm(ICollection names, LoadAssemblyInfo cai) { m_lai = cai; InitializeComponent(); if (names.Count > 0) { _create_manifest(names); } }
// 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. // public AssemblyDependencies(string name, LoadAssemblyInfo cai) { AssemblyRef ar = null; m_load = LoadAssembly.CreateLoader(cai); try { Trace.WriteLine("Name: " + name); AssemblyName an = m_load.GetAssemblyName(name); Trace.WriteLine("assembly name: " + an.Name); Trace.WriteLine("assembly full name: " + an.FullName); ar = m_load.LoadAssemblyName(an); Trace.WriteLine("Successfully loaded assembly."); } catch (Exception e) { Trace.WriteLine("m_load.LoadAssemblyName threw an exception:\n " + e.ToString()); Trace.WriteLine("\tStackTrace: " + e.StackTrace); /* * If ``m_load.LoadAssemblyName'' 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(); // 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)); // Get all referenced Assemblies. _traverse(search); }
// Create a LoadAssembly object based on ``i''. // // If ``i.LoadAs()'' doesn't return a value from the AssemblyLoadAs // enumeration, then an exception is thrown. public 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)); }
public static void Main(string[] args) { ParseOptions po = null; try { po = new ParseOptions(args); } catch (OptionException e) { _exit(e.Message); } if (po.Help) { _print_help(); } else if (po.Gui) { // if we've been asked to take over this process... if (po.TakeOverCurrentProcess) { Application.Run( new DependenciesForm(po.Files, po.LoadAssemblyInfo)); } else { // ...otherwise, spawn a new process. _create_gui_process(po.SerializeOptions()); } } else { // console output. m_lai = po.LoadAssemblyInfo; m_config = po.ConfigurationFile; _display_files(po.Files); } }
// Create a new AppDomain to load the assembly ``an''. protected static AppDomain CreateAppDomain(AssemblyName an, LoadAssemblyInfo info) { Trace.WriteLine("Loading a custom assembly for: " + an.FullName); String fname = String.Format(Localization.FMT_APPDOMAIN_NAME, an.FullName); Trace.WriteLine(" -- Friendly Name of new AppDomain: " + fname); Debug.Assert(an.CodeBase != null, "The AssemblyName CodeBase must be set!"); /* * The Application Base Path used to create the domain should be the * directory that the Assembly is located in. If AppPath() is null, * then we should consult use the AssemblyName's CodeBase as the App * Base Path. */ String appbase = info.AppPath(); if (appbase == null) { appbase = _furi_to_dir(an.CodeBase); } AppDomain ad = AppDomain.CreateDomain( fname, // friendlyName null, // securityInfo appbase, // appBasePath info.RelPath(), // relativeSearchPath false // shadowCopyFiles ); Trace.WriteLine(" -- created AppDomain"); return(ad); }
private static LoadAssembly _create_custom_get(LoadAssemblyInfo cai) { return(new LoadCustomGetAssembly(cai)); }
private static LoadAssembly _create_default(LoadAssemblyInfo cai) { return(new LoadDefaultAssembly()); }
internal LoadCustomGetAssembly(LoadAssemblyInfo i) : base(i) { }
internal LoadCustomAssembly(LoadAssemblyInfo i) { m_info = i; }