Esempio n. 1
0
        public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log)
        {
            _graph.PolicyTypes.Each(type =>
            {
                if (type.CanBeCastTo <ICombinationPolicy>() && type.IsConcreteWithDefaultCtor())
                {
                    log.Trace("Registering {0} as an ICombinationPolicy", type.FullName);
                    var policy = Activator.CreateInstance(type).As <ICombinationPolicy>();

                    _combinations.Add(policy);
                }
            });

            _graph.ForCombinations((name, assetNames) =>
            {
                var mimeType = MimeType.MimeTypeByFileName(assetNames.First());
                _cache.AddFilesToCandidate(mimeType, name, assetNames.Select(x => _fileGraph.Find(x)));
            });
        }
Esempio n. 2
0
        public void Activate(IEnumerable <IPackageInfo> packages, IPackageLog log)
        {
            _graph.PolicyTypes.Each(type =>
            {
                if (type.CanBeCastTo <IAssetPolicy>())
                {
                    log.Trace("Registering {0} as an IAssetPolicy", type.FullName);
                    _container.Inject(typeof(IAssetPolicy), type);
                }

                if (type.CanBeCastTo <ICombinationPolicy>())
                {
                    log.Trace("Registering {0} as an ICombinationPolicy", type.FullName);
                    _container.Inject(typeof(ICombinationPolicy), type);
                }
            });

            _graph.ForCombinations((name, assetNames) =>
            {
                var mimeType = MimeType.MimeTypeByFileName(assetNames.First());
                _cache.AddFilesToCandidate(mimeType, name, assetNames.Select(x => _pipeline.Find(x)));
            });
        }