Example #1
0
        public static SelectionRule GetRule(this IPropertiesContainer container)
        {
            SelectionRule result = null;

            if (container is IThreatModelChild child && child.Model is IThreatModel model)
            {
                var schemaManager = new AutoThreatGenPropertySchemaManager(model);
                var propertyType  = schemaManager?.GetPropertyType();
                if (propertyType != null)
                {
                    var p = container.GetProperty(propertyType);
                    if (p is IPropertyJsonSerializableObject jsonProperty)
                    {
                        if (jsonProperty.Value is SelectionRule rule)
                        {
                            result = rule;
                        }
                    }
                }
            }

            return(result);
        }
Example #2
0
 public MitigationSelectionRule([NotNull] SelectionRule rule)
 {
     Root = rule.Root;
 }