当前位置: 首页>>代码示例>>C#>>正文


C# IAsset.Update方法代码示例

本文整理汇总了C#中IAsset.Update方法的典型用法代码示例。如果您正苦于以下问题:C# IAsset.Update方法的具体用法?C# IAsset.Update怎么用?C# IAsset.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAsset的用法示例。


在下文中一共展示了IAsset.Update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessReplica

        private void ProcessReplica()
        {
            //1. Create Target Asset
            targetAsset = targetMediaContext.Assets.Create(triggerAsset.Name, AssetCreationOptions.None);
            IAccessPolicy writePolicy = targetMediaContext.AccessPolicies.Create("writePolicy_" + targetAsset.Name, TimeSpan.FromMinutes(120), AccessPermissions.Write);
            ILocator destinationLocator = targetMediaContext.Locators.CreateLocator(LocatorType.Sas, targetAsset, writePolicy);

            //2. Copy each File fron Origin to Target
            //2.1 Target Asset Storage

            CloudBlobClient targetAssetClient = targetStorageAccount.CreateCloudBlobClient();
            CloudBlobContainer targetAssetContainer = targetAssetClient.GetContainerReference(targetAsset.Uri.Segments[1]);

            //2.2 Trigger (origen) Asset Storage
            CloudBlobClient triggerAssetClient = triggerStorageAccount.CreateCloudBlobClient();
            CloudBlobContainer triggerAssetContainer = triggerAssetClient.GetContainerReference(triggerAsset.Uri.Segments[1]);

            //3. Start Copy all Files
            foreach (IAssetFile triggerAssetFile in triggerAsset.AssetFiles)
            {
                //if (triggerAssetFile.Name.ToLower().EndsWith(".mp4"))
                {
                    string triggerAssetFileUrl = triggerAsset.Uri.AbsoluteUri + "/" + triggerAssetFile.Name;
                    string targetAssetFileUrl = targetAsset.Uri.AbsoluteUri + "/" + triggerAssetFile.Name;
                    startCopyBlob(triggerAssetContainer, triggerAssetFileUrl, targetAssetContainer, targetAssetFileUrl);
                }
            }

            //4. Wait all copy process finish
            CloudBlockBlob blobStatusCheck;
            bool waitLighTrafic = true;
            while (waitLighTrafic)
            {
                waitLighTrafic = false;
                foreach (IAssetFile triggerAssetFile in triggerAsset.AssetFiles)
                {
                   // if (triggerAssetFile.Name.ToLower().EndsWith(".mp4"))
                    {
                        blobStatusCheck = (CloudBlockBlob)targetAssetContainer.GetBlobReferenceFromServer(triggerAssetFile.Name);
                        Trace.TraceInformation("{0} copy {1} bytes of {2} Bytes", triggerAssetFile.Name, blobStatusCheck.CopyState.BytesCopied, blobStatusCheck.CopyState.TotalBytes);
                        waitLighTrafic = (blobStatusCheck.CopyState.Status == CopyStatus.Pending);
                    }
                }
                Task.Delay(TimeSpan.FromSeconds(10d)).Wait();
            }

            foreach (IAssetFile triggerAssetFile in triggerAsset.AssetFiles)
            {
                //if (triggerAssetFile.Name.ToLower().EndsWith(".mp4"))
                {
                    //Add the xFile to Asset
                    var assetFile = targetAsset.AssetFiles.Create(triggerAssetFile.Name);
                }
            }

            destinationLocator.Delete();
            writePolicy.Delete();

            targetAsset.Update();
        }
开发者ID:pitcrew,项目名称:MediaBlutlerTest01,代码行数:60,代码来源:ProcessReplicaStep.cs

示例2: CreateCommonTypeContentKey

        static public IContentKey CreateCommonTypeContentKey(IAsset asset, CloudMediaContext _context, Guid keyId, byte[] contentKey)
        {

            IContentKey key = _context.ContentKeys.Create(
                                    keyId,
                                    contentKey,
                                    "ContentKey CENC",
                                    ContentKeyType.CommonEncryption);

            // Associate the key with the asset.
            asset.ContentKeys.Add(key);
            asset.Update();

            return key;
        }
开发者ID:sk-bln,项目名称:Azure-Media-Services-Explorer,代码行数:15,代码来源:DynamicEncryption.cs


注:本文中的IAsset.Update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。