private void BuildLocatorsTree() { // LOCATORS TREE IAsset MyAsset = MyContext.Assets.Where(a => a.Id == MyProgram.AssetId).Single(); var ismFile = MyAsset.AssetFiles.AsEnumerable().FirstOrDefault(f => f.Name.EndsWith(".ism")); if (ismFile != null) { var locators = MyAsset.Locators.Where(l => l.Type == LocatorType.OnDemandOrigin); var template = new UriTemplate("{contentAccessComponent}/{ismFileName}/manifest"); TreeViewLocators.BeginUpdate(); TreeViewLocators.Nodes.Clear(); foreach (ILocator locator in locators) { Color colornode; string locatorstatus = string.Empty; switch (AssetInfo.GetPublishedStatusForLocator(locator)) { case PublishStatus.PublishedActive: colornode = Color.Black; locatorstatus = "Active"; break; case PublishStatus.PublishedExpired: colornode = Color.Red; locatorstatus = "Expired"; break; case PublishStatus.PublishedFuture: colornode = Color.Blue; locatorstatus = "Future"; break; default: colornode = Color.Black; break; } TreeNode myLocNode = new TreeNode(string.Format("{0} ({1}) {2}", locator.Type.ToString(), locatorstatus, locator.Name)); myLocNode.ForeColor = colornode; TreeViewLocators.Nodes.Add(myLocNode); TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes.Add(new TreeNode("Locator information")); TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes[0].Nodes.Add(new TreeNode( string.Format("Name: {0}", locator.Name) )); TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes[0].Nodes.Add(new TreeNode( string.Format("Type: {0}", locator.Type.ToString()) )); TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes[0].Nodes.Add(new TreeNode( string.Format("Path: {0}", (locator.Path)) )); if (locator.StartTime != null) { TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes[0].Nodes.Add(new TreeNode( string.Format("Start time: {0}", (((DateTime)locator.StartTime).ToLocalTime().ToString())) )); } if (locator.ExpirationDateTime != null) { TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes[0].Nodes.Add(new TreeNode( string.Format("Expiration date time: {0}", (((DateTime)locator.ExpirationDateTime).ToLocalTime().ToString())) )); } TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes[0].Nodes.Add(new TreeNode( string.Format("ID: {0}", (locator.Id)) )); if (locator.Type == LocatorType.OnDemandOrigin) { int indexn = 1; if (locator.GetSmoothStreamingUri() != null) { TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes.Add(new TreeNode(AssetInfo._smooth)); TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes[indexn].Nodes.Add(new TreeNode(locator.GetSmoothStreamingUri().ToString())); // legacy smooth streaming without repeat tag (manifest v2.0) TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes.Add(new TreeNode(AssetInfo._smooth_legacy)); TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes[indexn + 1].Nodes.Add(new TreeNode(AssetInfo.GetSmoothLegacy(locator.GetSmoothStreamingUri().ToString()))); indexn = indexn + 2; } if (locator.GetMpegDashUri() != null) { TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes.Add(new TreeNode(AssetInfo._dash)); TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes[indexn].Nodes.Add(new TreeNode(locator.GetMpegDashUri().ToString())); indexn++; } if (locator.GetHlsUri() != null) { TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes.Add(new TreeNode(AssetInfo._hls_v4)); TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes[indexn].Nodes.Add(new TreeNode(locator.GetHlsUri().ToString())); TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes.Add(new TreeNode(AssetInfo._hls_v3)); TreeViewLocators.Nodes[MyAsset.Locators.IndexOf(locator)].Nodes[indexn + 1].Nodes.Add(new TreeNode(locator.GetHlsUri().ToString().Replace("format=m3u8-aapl", "format=m3u8-aapl-v3"))); indexn = indexn + 2; } } } TreeViewLocators.EndUpdate(); } }
public static AssetBitmapAndText BuildBitmapPublication(string assetName, AMSClientV3 client) { Bitmap returnedImage = null; string returnedText = null; client.RefreshTokenIfNeeded(); IList <AssetStreamingLocator> locators; try { locators = client.AMSclient.Assets.ListStreamingLocators(client.credentialsEntry.ResourceGroup, client.credentialsEntry.AccountName, assetName).StreamingLocators; } catch { return(new AssetBitmapAndText() { bitmap = BitmapCancel, MouseOverDesc = "Error" }); } foreach (var locator in locators) { Bitmap newbitmap = null; string newtext = null; PublishStatus Status = AssetInfo.GetPublishedStatusForLocator(locator); { switch (Status) { case PublishStatus.PublishedActive: newbitmap = Streaminglocatorimage; newtext = "Active Streaming locator"; break; case PublishStatus.PublishedExpired: newbitmap = Redstreamimage; newtext = "Expired Streaming locator"; break; case PublishStatus.PublishedFuture: newbitmap = Bluestreamimage; newtext = "Future Streaming locator"; break; case PublishStatus.NotPublished: default: break; } } returnedImage = AddBitmap(returnedImage, newbitmap); returnedText += !string.IsNullOrEmpty(newtext) ? newtext + Constants.endline : string.Empty; } return(new AssetBitmapAndText() { bitmap = returnedImage, MouseOverDesc = returnedText ?? "Not published" }); }