public static NuspecTag Parse(XElement element) { var result = new NuspecTag(); foreach (var nuspecSubtag in element.Elements()) { var name = nuspecSubtag.Name.LocalName; if (string.Equals(name, NupsecPathTagName, StringComparison.OrdinalIgnoreCase)) { result.Pathes.Add(nuspecSubtag.Value.Trim()); } else if (string.Equals(name, PackageProjectException.ExceptionTagName, StringComparison.OrdinalIgnoreCase)) { result.Exceptions.Add(PackageProjectException.Parse(nuspecSubtag)); } } return(result); }
public static RuleConfiguration Parse(XElement ruleConfig) { var result = new RuleConfiguration(); var enabledValue = ruleConfig.Attribute(EnabledAttributeName)?.Value; result.IsEnabled = string.Equals(enabledValue, "true", StringComparison.OrdinalIgnoreCase); foreach (var mainElement in ruleConfig.Elements()) { var name = mainElement.Name.LocalName; if (string.Equals(name, NuspecTagName, StringComparison.OrdinalIgnoreCase)) { result.Specs.Add(NuspecTag.Parse(mainElement)); } else if (string.Equals(name, PackageProjectException.ExceptionTagName, StringComparison.OrdinalIgnoreCase)) { result.Exceptions.Add(PackageProjectException.Parse(mainElement)); } } return(result); }