private void Validate() { string message = ""; StringBuilder messageBuilder = new StringBuilder(100); string huburl = HubUrl.Trim(); string packagesRepo = PackagesRepoUrl.Trim(); if (string.IsNullOrEmpty(packagesRepo)) { messageBuilder.AppendLine("PackagesRepoUrl is required"); } if (String.IsNullOrEmpty(huburl)) { List <string> operationList = new List <string>(3); if (DeployHubBdio || CreateHubReport || CheckPolicies) { messageBuilder.Append("Cannot perform the following operations because hub_url is empty: "); } if (DeployHubBdio) { operationList.Add("deploy BDIO"); } if (CreateHubReport) { operationList.Add("create risk report"); } if (CheckPolicies) { operationList.Add("check policies"); } if (operationList.Count > 0) { messageBuilder.AppendLine(String.Join(", ", operationList)); } } message = messageBuilder.ToString(); if (!String.IsNullOrEmpty(message)) { throw new BlackDuckIntegrationException(message); } }
private List <PackageMetadataResource> CreateMetaDataResourceList(List <Lazy <INuGetResourceProvider> > providers) { List <PackageMetadataResource> list = new List <PackageMetadataResource>(); string[] splitRepoUrls = PackagesRepoUrl.Split(new char[] { ',' }); foreach (string repoUrl in splitRepoUrls) { string url = repoUrl.Trim(); if (!String.IsNullOrWhiteSpace(url)) { PackageSource packageSource = new PackageSource(url); SourceRepository sourceRepository = new SourceRepository(packageSource, providers); PackageMetadataResource packageMetadataResource = sourceRepository.GetResource <PackageMetadataResource>(); list.Add(packageMetadataResource); } } return(list); }