예제 #1
0
 private static Module GetNestedModule(Module module, string modName, ref string modLocation)
 {
     if (module == null || modName == null) { Debug.Assert(false); return null; }
     Module mod = module.GetNestedModule(modName);
     if (mod == null)
     {
         if (module.Location != null)
             modLocation = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(module.Location), modName);
         if (modLocation != null && System.IO.File.Exists(modLocation))
         {
             mod = Module.GetModule(modLocation);
             if (mod != null)
             {
                 mod.ContainingAssembly = module.ContainingAssembly;
                 module.ModuleReferences.Add(new ModuleReference(modName, mod));
             }
         }
     }
     if (mod == null)
     {
         HandleError(module, String.Format(CultureInfo.CurrentCulture,
           ExceptionStrings.CouldNotFindReferencedModule, modLocation));
         mod = new Module();
         mod.Name = modName;
         mod.ContainingAssembly = module.ContainingAssembly;
         mod.Kind = ModuleKind.DynamicallyLinkedLibrary;
     }
     return mod;
 }