IEnumerable<Ast> hashTableAsts = profileAst.FindAll(item => item is HashtableAst, false);
// no hashtable, raise warning
if (!hashTableAsts.Any())
{
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.InvalidProfile, settingsFilePath));
}
HashtableAst hashTableAst = hashTableAsts.First() as HashtableAst;
IEnumerable<Ast> hashTableAsts = profileAst.FindAll(item => item is HashtableAst, false);
// no hashtable, raise warning
if (!hashTableAsts.Any())
{
writer.WriteError(new ErrorRecord(new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.InvalidProfile, profile)),
Strings.ConfigurationFileHasNoHashTable, ErrorCategory.ResourceUnavailable, profile));
hasError = true;
}
else
{
HashtableAst hashTableAst = hashTableAsts.First() as HashtableAst;
if (!targetAsts.Any())
{
if (String.IsNullOrWhiteSpace(scopeAst.Extent.File))
{
ruleSupp.Error = String.Format(CultureInfo.CurrentCulture, Strings.RuleSuppressionErrorFormatScriptDefinition, ruleSupp.StartAttributeLine,
String.Format(Strings.TargetCannotBeFoundError, ruleSupp.Target, ruleSupp.Scope));
}
else
{
ruleSupp.Error = String.Format(CultureInfo.CurrentCulture, Strings.RuleSuppressionErrorFormat, ruleSupp.StartAttributeLine,
System.IO.Path.GetFileName(scopeAst.Extent.File), String.Format(Strings.TargetCannotBeFoundError, ruleSupp.Target, ruleSupp.Scope));
}
result.Add(ruleSupp);
continue;
}
foreach (Ast targetAst in targetAsts)
{