Пример #1
0
        public static FeaturesSet CreateFeaturesSet()
        {
            FeaturesSet featuresSet = new FeaturesSet();

            foreach (Feature group in FeatureHelper.GetFeaturesWithType(NodeType.Parent))
            {
                FeatureNode groupNode = new FeatureNode {
                    Name    = group.GetDisplayName(),
                    Feature = group,
                    State   = FeatureState.Undefined,
                    Type    = NodeType.Parent
                };

                foreach (Feature feature in group.GetChildFeatures())
                {
                    groupNode.Nodes.Add(new FeatureNode {
                        Name    = feature.GetDisplayName(),
                        Feature = feature,
                        State   = FeatureState.Undefined,
                        Type    = NodeType.Feature
                    });
                }

                featuresSet.Nodes.Add(groupNode);
            }

            return(featuresSet);
        }
Пример #2
0
        public static FeaturesSet GetFeaturesForProfile(Profile profile)
        {
            List <Feature> featuresForProfile = GetFeatures(profile);

            FeaturesSet set = FeaturesSet.CreateFeaturesSet();

            foreach (var featureNode in set.Nodes)
            {
                featureNode.Nodes.RemoveAll(item => !featuresForProfile.Contains(item.Feature));
            }

            set.Nodes.RemoveAll(item => 0 == item.Nodes.Count);

            return(set);
        }