private IEnumerable <DependencyReferenceDescriptor> ProcessExtensionReferences(ExtensionLoadingContext context, ExtensionProbeEntry activatedExtension)
        {
            if (activatedExtension == null)
            {
                return(Enumerable.Empty <DependencyReferenceDescriptor>());
            }

            var referenceNames = (context.ReferencesByModule.ContainsKey(activatedExtension.Descriptor.Id) ?
                                  context.ReferencesByModule[activatedExtension.Descriptor.Id] :
                                  Enumerable.Empty <ExtensionReferenceProbeEntry>())
                                 .Select(r => r.Name)
                                 .Distinct(StringComparer.OrdinalIgnoreCase);

            var referencesDecriptors = new List <DependencyReferenceDescriptor>();

            foreach (var referenceName in referenceNames)
            {
                ProcessExtensionReference(context, referenceName, referencesDecriptors);
            }

            return(referencesDecriptors);
        }
        private DateTime GetVirtualPathDepedenciesModificationTimeUtc(ConcurrentDictionary <string, DateTime> virtualPathDependencies, ExtensionProbeEntry probe)
        {
            if (!probe.VirtualPathDependencies.Any())
            {
                return(DateTime.MinValue);
            }

            Logger.InfoFormat("Retrieving modification dates of dependencies of extension '{0}'", probe.Descriptor.Id);

            var result = probe.VirtualPathDependencies.Max(path => GetVirtualPathModificationTimeUtc(virtualPathDependencies, path));

            Logger.InfoFormat("Done retrieving modification dates of dependencies of extension '{0}'", probe.Descriptor.Id);
            return(result);
        }
        private DateTime?GetVirtualPathDepedenciesModificationTimeUtc(ConcurrentDictionary <string, DateTime> virtualPathDependencies, ExtensionProbeEntry probe)
        {
            if (!probe.VirtualPathDependencies.Any())
            {
                return(null);
            }

            Logger.Information("正在修改扩展 '{0}' 依赖项的日期", probe.Descriptor.Id);

            var result = probe.VirtualPathDependencies.Max(path => GetVirtualPathModificationTimeUtc(virtualPathDependencies, path));

            Logger.Information("完成扩展 '{0}' 依赖项的日期修改", probe.Descriptor.Id);
            return(result);
        }
        /// <summary>
        /// 探测。
        /// </summary>
        /// <param name="descriptor">扩展描述符条目。</param>
        /// <returns>扩展探测条目。</returns>
        public override ExtensionProbeEntry Probe(ExtensionDescriptorEntry descriptor)
        {
            if (Disabled)
                return null;

            Logger.Information("探测模块 '{0}'", descriptor.Id);

            var assemblyPath = GetAssemblyPath(descriptor);
            if (assemblyPath == null)
                return null;

            var result = new ExtensionProbeEntry
            {
                Descriptor = descriptor,
                Loader = this,
                VirtualPath = assemblyPath,
                VirtualPathDependencies = new[] { assemblyPath },
            };

            Logger.Information("完成模块 '{0}' 探测", descriptor.Id);
            return result;
        }