public static void ThrowIfRightsTemplatesInvalid(IEnumerable <string> templates, string tpdName, TrustedPublishingDomainImportUtilities tpdImportUtilities, Uri intranetLicensingUrl, Uri extranetLicensingUrl, out object failureTarget) { failureTarget = null; if (templates != null) { RmsUtil.ThrowIfStringParameterNullOrEmpty(tpdName, "tpdName"); RmsUtil.ThrowIfParameterNull(tpdImportUtilities, "tpdImportUtilities"); RmsUtil.ThrowIfParameterNull(intranetLicensingUrl, "intranetLicensingUrl"); RmsUtil.ThrowIfParameterNull(extranetLicensingUrl, "extranetLicensingUrl"); foreach (string template in templates) { Uri templateDistributionPoint; Uri templateDistributionPoint2; Guid templateGuid; try { DrmClientUtils.ParseTemplate(template, out templateDistributionPoint, out templateDistributionPoint2, out templateGuid); } catch (RightsManagementException innerException) { failureTarget = tpdName; throw new InvalidTemplateException(innerException); } RmsUtil.ThrowIfRightsTemplateInvalid(tpdImportUtilities, tpdName, template, templateGuid, out failureTarget); RmsUtil.ThrowIfTemplateDistributionPointInvalid(templateDistributionPoint, RmsUtil.TemplateDistributionPointType.Intranet, templateGuid, intranetLicensingUrl, extranetLicensingUrl, out failureTarget); RmsUtil.ThrowIfTemplateDistributionPointInvalid(templateDistributionPoint2, RmsUtil.TemplateDistributionPointType.Extranet, templateGuid, intranetLicensingUrl, extranetLicensingUrl, out failureTarget); } } }