Exemple #1
0
        internal Module Import(string path)
        {
            path = processPath(path);

            var e = new ResolveModuleEventArgs(path);

            for (var i = 0; i < __resolveModuleHandlers.Count && e.Module == null; i++)
            {
                __resolveModuleHandlers[i](this, e);
            }

            if (e.Module == null)
            {
                throw new InvalidOperationException("Unable to load module \"" + path + "\"");
            }

            if (e.AddToCache && !__modulesCache.ContainsKey(e.ModulePath))
            {
                __modulesCache[e.ModulePath] = e.Module;
            }

            if (e.Module.FilePath == null)
            {
                e.Module.FilePath = path;
            }

            return(e.Module);
        }
Exemple #2
0
 private static void defaultModuleResolver(Module sender, ResolveModuleEventArgs e)
 {
     __modulesCache.TryGetValue(e.ModulePath, out var result);
     e.Module = result;
 }