コード例 #1
0
        public DependenciesInfo BuildDependenciesInfo(DependenciesSection configSection, int osBuild)
        {
            bool supported = TryGetOsBuildNumber(configSection, ref osBuild);

            if (!supported)
            {
                throw new NotSupportedOperatingSystemException(osBuild);
            }

            var info = new DependenciesInfo
            {
                CompatibleOsBuild = osBuild,
                EvaluationContext = new EvaluationContext(),
                Dependencies      = new List <Dependency>()
            };


            // Add common checks & dependencies
            this.AddDependencyChecks(info, configSection.CommonChecks);
            this.AddDependencies(info, configSection.MinimumRequirements.Dependencies);

            // Add OS checks & dependencies
            DependencyGroup osDependencyGroup = configSection.DependencyGroups.GetDependencyGroupByOsBuild(osBuild);

            if (osDependencyGroup != null)
            {
                this.AddDependencyChecks(info, osDependencyGroup.Checks);
                this.AddDependencies(info, osDependencyGroup.Dependencies);
            }

            // Add evaluators
            this.AddCheckEvaluators((EvaluationContext)info.EvaluationContext, configSection.CheckEvaluators);

            return(info);
        }
コード例 #2
0
 private void AddDependencies(DependenciesInfo info, DependencyElementCollection dependencies)
 {
     foreach (DependencyElement dependencyElement in dependencies)
     {
         if (dependencyElement.Enabled)
         {
             info.Dependencies.Add(this.GetDependency(dependencyElement));
         }
     }
 }
コード例 #3
0
        private void AddDependencyChecks(DependenciesInfo info, DependencyCheckCollection checks)
        {
            if (checks == null)
            {
                return;
            }

            foreach (DependencyCheck dependencyCheck in checks)
            {
                Check check = this.GetCheck(dependencyCheck);
                info.EvaluationContext[check.Name] = check;
            }
        }