public static async Task <IEnumerable <AssetFileMetadata> > ParseAssetFileMetadataAsync(Uri assetFileMetadataUri) { IList <AssetFileMetadata> assetFileMetadataList = new List <AssetFileMetadata>(); try { using (var assetFileMetadataStream = new MemoryStream()) { var blob = new CloudBlockBlob(assetFileMetadataUri); await blob.DownloadToStreamAsync(assetFileMetadataStream, null, null, null).ConfigureAwait(false); assetFileMetadataStream.Seek(0, SeekOrigin.Begin); var root = XElement.Load(assetFileMetadataStream); foreach (var assetFileElement in root.Elements()) { assetFileMetadataList.Add(AssetFileMetadata.Load(assetFileElement)); } } } catch { } return(assetFileMetadataList); }
internal static AssetFileMetadata Load(XElement assetFileElement) { var assetFileMetadata = new AssetFileMetadata { Name = assetFileElement.GetAttributeOrDefault(AssetMetadataParser.NameAttributeName), Size = assetFileElement.GetAttributeAsLongOrDefault(AssetMetadataParser.SizeAttributeName), Duration = assetFileElement.GetAttributeAsTimeSpanOrDefault(AssetMetadataParser.DurationAttributeName) }; return(assetFileMetadata); }