public ExtensionEntry Load(ExtensionDescriptor descriptor)
        {
            if (!ExtensionsSearchPaths.Contains(descriptor.Location))
            {
                return(null);
            }

            var directory = _fileSystem.GetDirectoryInfo(descriptor.Location);

            using (_loaderContainer.AddLoader(_extensionAssemblyLoader.WithPath(directory.FullName)))
            {
                try
                {
                    var assembly = Assembly.Load(new AssemblyName(descriptor.Id));

                    if (_logger.IsEnabled(LogLevel.Information))
                    {
                        _logger.LogInformation("Loaded referenced extension \"{0}\": assembly name=\"{1}\"", descriptor.Name, assembly.FullName);
                    }
                    return(new ExtensionEntry
                    {
                        Descriptor = descriptor,
                        Assembly = assembly,
                        ExportedTypes = assembly.ExportedTypes
                    });
                }
                catch (System.Exception ex)
                {
                    _logger.LogError(string.Format("Error trying to load extension {0}", descriptor.Id), ex);
                    throw;
                }
            }
        }
示例#2
0
        public ExtensionEntry Load(ExtensionDescriptor descriptor)
        {
            if (!descriptor.Location.StartsWith("Core"))
            {
                return(null);
            }

            var directory = _fileSystem.GetDirectoryInfo("Core");

            using (_loaderContainer.AddLoader(_extensionAssemblyLoader.WithPath(directory.FullName)))
            {
                var assembly = Assembly.Load(new AssemblyName(CoreAssemblyName));

                if (_logger.IsEnabled(LogLevel.Information))
                {
                    _logger.LogInformation("Loaded referenced extension \"{0}\": assembly name=\"{1}\"", descriptor.Name, assembly.FullName);
                }
                return(new ExtensionEntry
                {
                    Descriptor = descriptor,
                    Assembly = assembly,
                    ExportedTypes = assembly.ExportedTypes.Where(x => IsTypeFromModule(x, descriptor))
                });
            }
        }
        public static IOrchardFileSystem GetSubPathFileProvider(
            this IOrchardFileSystem parentFileSystem,
            string subPath,
            ILogger logger)
        {
            var root = parentFileSystem.GetDirectoryInfo(subPath).FullName;

            return(new OrchardFileSystem(root, new PhysicalFileProvider(root), logger));
        }
示例#4
0
        public ExtensionEntry Load(ExtensionDescriptor descriptor)
        {
            if (ExtensionsSearchPaths == null || descriptor == null || !ExtensionsSearchPaths.Contains(descriptor.Location))
            {
                return(null);
            }

            var directory = _fileSystem.GetDirectoryInfo(descriptor.Location);

            return(null);
        }
示例#5
0
        public PhysicalAppDataFolder(
            IOrchardFileSystem parentFileSystem,
            ILogger <PhysicalAppDataFolder> logger)
        {
            _logger = logger;

            if (!parentFileSystem.DirectoryExists(InternalRootPath))
            {
                parentFileSystem.CreateDirectory(InternalRootPath);
            }

            var root = parentFileSystem.GetDirectoryInfo(InternalRootPath).FullName;

            _fileSystem = new OrchardFileSystem(root, new PhysicalFileProvider(root), _logger);
        }
示例#6
0
        public PhysicalAppDataFolder(
            IOrchardFileSystem parentFileSystem,
            ILogger<PhysicalAppDataFolder> logger)
        {
            _logger = logger;

            if (!parentFileSystem.DirectoryExists(InternalRootPath))
            {
                parentFileSystem.CreateDirectory(InternalRootPath);
            }

            var root = parentFileSystem.GetDirectoryInfo(InternalRootPath).FullName;

            _fileSystem = new OrchardFileSystem(root, new PhysicalFileProvider(root), _logger);
        }
示例#7
0
 public DirectoryInfo GetDirectoryInfo(string path)
 {
     return(_fileSystem.GetDirectoryInfo(path));
 }