This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TableQuery<BookEntity> query = | |
| (from book in bookTable.CreateQuery<BookEntity>() | |
| where book.PartitionKey == "hardback" | |
| select book).AsTableQuery<BookEntity>(); | |
| TableContinuationToken continuationToken = null; | |
| do { | |
| var queryResult = query.ExecuteSegmented(continuationToken); | |
| foreach (BookEntity entity in queryResult) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public TableQuerySegment<TElement> | |
| ExecuteSegmented(TableContinuationToken continuationToken, | |
| TableRequestOptions requestOptions = null, | |
| OperationContext operationContext = null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var query = (from book in bookTable.CreateQuery<BookEntity>() | |
| where book.PartitionKey == "hardback" | |
| select book).Take(10); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CloudStorageAccount storageAccount = new CloudStorageAccount( | |
| new StorageCredentials(accountName, accountKey), true); | |
| CloudTableClient tableClient = storageAccount.CreateCloudTableClient(); | |
| CloudTable bookTable = tableClient.GetTableReference("book"); | |
| var query = from book in bookTable.CreateQuery<BookEntity>() | |
| where book.PartitionKey == "hardback" | |
| select book; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private String GetStreamingUrl(IJob job) | |
| { | |
| IAsset assetToStream = job.OutputMediaAssets[0]; | |
| var theManifest = | |
| from f in assetToStream.AssetFiles | |
| where f.Name.EndsWith(".ism") | |
| select f; | |
| IAssetFile manifestFile = theManifest.First(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private List<String> GetDownloadAssetSasList(IJob job) | |
| { | |
| IAsset assetToDownload = job.OutputMediaAssets[0]; | |
| IAccessPolicy sharedAccessPolicy = context.AccessPolicies.Create( | |
| "DownloadFor7DaysPolicy", | |
| TimeSpan.FromDays(7), | |
| AccessPermissions.Read | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String inputAssetId = ASSET_ID; | |
| IJob job = context.Jobs.Create("Encoding job"); | |
| // Note that there are two Windows Azure Media Encoder processors | |
| IMediaProcessor processor = context.MediaProcessors | |
| .Where(p => p.Name == "Windows Azure Media Encoder") | |
| .ToList() | |
| .OrderBy(p => new Version(p.Version)) | |
| .LastOrDefault(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String pathToFile = PATH_TO_MEDIA_FILE; | |
| String fileName = Path.GetFileName(pathToFile); | |
| String assetName = "SOME ASSET NAME"; | |
| CloudMediaContext context = new CloudMediaContext( | |
| ACCOUNT_NAME, ACCOUNT_KEY); | |
| IAsset asset = context.Assets.Create( | |
| assetName, AssetCreationOptions.None); | |
| IAssetFile assetFile = asset.AssetFiles.Create(fileName); | |
| assetFile.Upload(pathToFile); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CloudMediaContext context = | |
| new CloudMediaContext(ACCOUNT_NAME, ACCOUNT_KEY); | |
| DateTime tenDaysAgo = DateTime.UtcNow.AddDays(-10); | |
| var jobQuery = | |
| from job in context.Jobs | |
| where job.Created >= tenDaysAgo | |
| select job; | |
| List<IJob> jobs = jobQuery.ToList(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void GetMessage(String queueName) | |
| { | |
| string requestMethod = "GET"; | |
| String urlPath = String.Format("{0}/messages", queueName); | |
| String storageServiceVersion = "2012-02-12"; | |
| String dateInRfc1123Format = DateTime.UtcNow.ToString("R", CultureInfo.InvariantCulture); | |
| String canonicalizedHeaders = String.Format( | |
| "x-ms-date:{0}\nx-ms-version:{1}", |