Esempio n. 1
0
        /// <summary>
        /// Loads features to be detected into a FeatureSet object using metadata stored in a single FeatureConfig object
        /// </summary>
        /// <param name="featureConfig">FeatureConfig object</param>
        /// <returns>FeatureSet object containing all features loaded into memory</returns>
        public static FeatureSet LoadFeatureSetFromFeatureConfig(FeatureConfig featureConfig)
        {
            var compiledFeatures   = new HashSet <CompiledFeature>();
            var configuredFeatures = new HashSet <ConfiguredFeature>();

            foreach (var featureGroup in featureConfig.FeatureGroups)
            {
                var featureScope          = featureGroup.FeatureScope;
                var newCompiledFeatures   = FeatureLoader.LoadCompiledFeaturesFromAssemblies(featureScope, featureGroup.CompiledFeatureAssemblies);
                var newConfiguredFeatures = FeatureLoader.LoadConfiguredFeatures(featureScope, featureGroup.ConfiguredFeatures);

                compiledFeatures.UnionWith(newCompiledFeatures);
                configuredFeatures.UnionWith(newConfiguredFeatures);
            }

            return(new FeatureSet(compiledFeatures, configuredFeatures));
        }
Esempio n. 2
0
        /// <summary>
        /// Create a FeatureSet using feature types
        /// </summary>
        /// <param name="types">Types of features to include</param>
        /// <returns>FeatureSet containing the features of the specified types</returns>
        public static FeatureSet LoadFeatureSetFromTypes(IEnumerable <Type> types)
        {
            var features = FeatureLoader.LoadFeaturesByTypes(types);

            return(new FeatureSet(features));
        }