/// <summary> /// Downloads the list of Ckan Repositories from the passed URL. /// </summary> /// <param name="repoListURL">The URL to get the Ckan Repositories from.</param> /// <returns>The list of Ckan Repositories from the passed URL.</returns> public static CkanRepositories GetRepositoryList(Uri repoListURL = null) { CkanRepositories repos; if (repoListURL != null) { // load repositories from repoListURL Messenger.AddInfo($"Downloading repository list from \"{repoListURL.AbsoluteUri}\"..."); var content = Www.Load(repoListURL.AbsoluteUri); repos = JsonConvert.DeserializeObject <CkanRepositories>(content); Messenger.AddInfo($"Downloading repository list done. {repos.repositories.Length} repositories found."); } else { // create default repository repos = new CkanRepositories { repositories = new [] { CkanRepository.GitHubRepository } }; } return(repos); }
/// <summary> /// Gets the named Ckan Repository from the Ckan Repository list. /// </summary> /// <param name="repositories">List of Ckan Repository to search in.</param> /// <param name="repoName">Name of the Ckan Repository to look for.</param> /// <returns>The named Ckan Repository from the Ckan Repository list or null.</returns> public static CkanRepository GetRepository(CkanRepositories repositories, string repoName) { return(repositories.repositories.FirstOrDefault(x => x.name.Equals(repoName, StringComparison.CurrentCultureIgnoreCase))); }