Beispiel #1
0
        internal RuleBlock(SourceFile source, string ruleName, RuleHelpInfo info, PowerShell condition, TagSet tag, string[] dependsOn, Hashtable configuration, RuleExtent extent)
        {
            Source   = source;
            RuleName = ruleName;

            var scriptFileName = Path.GetFileName(Source.Path);

            // Get fully qualified Id, either RuleName or Module\RuleName
            RuleId = RuleHelper.ExpandRuleName(ruleName: ruleName, scriptFileName: scriptFileName, moduleName: Source.ModuleName);

            Info          = info;
            Condition     = condition;
            Tag           = tag;
            DependsOn     = dependsOn;
            Configuration = configuration;
            Extent        = extent;
        }
Beispiel #2
0
 internal RuleRecord(string ruleId, string ruleName, PSObject targetObject, string targetName, string targetType, TagSet tag, RuleHelpInfo info, Hashtable field, RuleOutcome outcome = RuleOutcome.None, RuleOutcomeReason reason = RuleOutcomeReason.None)
 {
     RuleId        = ruleId;
     RuleName      = ruleName;
     TargetObject  = targetObject;
     TargetName    = targetName;
     TargetType    = targetType;
     Outcome       = outcome;
     OutcomeReason = reason;
     Info          = info;
     if (tag != null)
     {
         Tag = tag.ToHashtable();
     }
     if (field != null && field.Count > 0)
     {
         Field = field;
     }
 }
Beispiel #3
0
 public bool Match(string name, TagSet tag)
 {
     return(_Include == null || _Include.Contains(name) || MatchWildcard(ruleName: name));
 }