public static void ListChildrensItemsAndAssets(IStacCatalog catalog, string prefix = "", int limit = 200) { // Get children first (sub catalogs and collections) foreach (var child_any_version in catalog.GetChildren().Values.Take(limit)) { IStacCatalog child = child_any_version.UpgradeToCurrentVersion(); Console.Out.WriteLine(prefix + child.Id + ": " + child.Description); foreach (var item_any_version in child.GetItems().Values.Take(limit)) { IStacItem item = item_any_version.UpgradeToCurrentVersion(); Console.Out.WriteLine(prefix + " " + item.Id); foreach (var asset in item.Assets.Values) { Console.Out.WriteLine(prefix + " *[" + asset.MediaType + "] " + asset.Uri); } } ListChildrensItemsAndAssets(child, prefix + " "); } }
public static void UpdateLinks(this IStacCatalog catalogNode, IEnumerable <IResource> resources) { foreach (var resource in resources) { if (resource == null) { continue; } foreach (var link in catalogNode.Links.Where(a => a != null && a.Uri.Equals(resource.Uri)).ToArray()) { catalogNode.Links.Remove(link); } if (resource is ICatalog) { catalogNode.Links.Add(StacLink.CreateChildLink(resource.Uri, resource.ContentType.ToString())); } if (resource is IItem) { catalogNode.Links.Add(StacLink.CreateItemLink(resource.Uri, resource.ContentType.ToString())); } } }
public StacCatalogNode(IStacCatalog stacCatalog, Uri uri, ICredentials credentials = null) : base(stacCatalog, uri, credentials) { }