// @return value: whether the persistence file has been updated.
        public ResolutionResult Resolve(INameConvention nameConvention, AddinFileSettings fileSettings, AssemblyLoadPolicy assemblyLoadPolicy,
                                        AddinStorage addinStorage, AddinRelationManager relationManager,
                                        ScanFilePackResult scanFilePackResult)
        {
            var ctx = new ResolutionContext();
            var cm  = new ConvertionManager();

            InitializeDataTransformers(ctx, cm);

            if (assemblyLoadPolicy.PrivateAssemblyProbingDirectories != null)
            {
                foreach (var privateAssemblyProbingDirectory in assemblyLoadPolicy.PrivateAssemblyProbingDirectories)
                {
                    AssemblyResolution.AddSearchDirectory(privateAssemblyProbingDirectory);
                }
            }

            var resolver = new DefaultAddinResolver(addinStorage, relationManager, cm);

            // 强制 ExtensionBuilder 节点应用 NameConvention
            return(resolver.Resolve(nameConvention, ctx, scanFilePackResult));
        }
示例#2
0
        // @return value: whether the persistence file (AddinIndexManager/AddinBodyRepository) has been updated.
        public bool Resolve(IMessageDialog dialog, FilePackResult filePackResult, string persistentFile, string transactionFile)
        {
            var storage      = StorageHelper.CreateStorage(persistentFile, transactionFile);
            var indexManager = new IndexManager {
                Storage = storage
            };

            if (indexManager.Read())
            {
                indexManager.Build();
            }
            var bodyRepo = new BodyRepository {
                Storage = storage
            };
            var convertionManager = new ConvertionManager();

            InitializeConvertion(convertionManager);

            var resolver    = new DefaultAddinResolver(indexManager, bodyRepo, convertionManager);
            var hasNewAddin = resolver.Resolve(dialog, filePackResult);

            //storage.Close();
            return(hasNewAddin);
        }