當前位置: 首頁>>代碼示例>>C#>>正文


C# CloudBlockBlob.DownloadToFile方法代碼示例

本文整理匯總了C#中Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.DownloadToFile方法的典型用法代碼示例。如果您正苦於以下問題:C# CloudBlockBlob.DownloadToFile方法的具體用法?C# CloudBlockBlob.DownloadToFile怎麽用?C# CloudBlockBlob.DownloadToFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob的用法示例。


在下文中一共展示了CloudBlockBlob.DownloadToFile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: downloadfile

        public void downloadfile(CloudBlockBlob file, string fileFullPath, DateTime timestamp)
        {
            //string leaseId = Guid.NewGuid().ToString();
            //file.AcquireLease(TimeSpan.FromMilliseconds(16000), leaseId);
            Program.ClientForm.addtoConsole("Download started:" + fileFullPath);
            file.DownloadToFile(fileFullPath, FileMode.Create);
            Program.ClientForm.addtoConsole("Downloaded! File : " + fileFullPath);
            Program.ClientForm.ballon("Downloaded:" + fileFullPath);
            //file.ReleaseLease(AccessCondition.GenerateLeaseCondition(leaseId));
            File.SetLastWriteTime(fileFullPath, TimeZoneInfo.ConvertTimeFromUtc(timestamp, TimeZoneInfo.Local));

            // add file to file list
            Client.LocalFileSysAccess.FileListMaintain addToFileList = new Client.LocalFileSysAccess.FileListMaintain();
            addToFileList.addSingleFileToFileList(fileFullPath);
        }
開發者ID:hangmiao,項目名稱:DBLike,代碼行數:15,代碼來源:LocalFileSys.cs

示例2: DownloadResults

        private void DownloadResults(string key, AzureBlobDataReference blobLocation)
        {
            if (_outputDestination != DestinationType.None)
            {
                var credentials = new StorageCredentials(blobLocation.SasBlobToken);
                var cloudBlob = new CloudBlockBlob(new Uri(new Uri(blobLocation.BaseLocation), blobLocation.RelativeLocation), credentials);

                if (_outputDestination == DestinationType.FileConnection)
                {
                    ConnectionManager connectionManager = _connections[_destination];
                    var connection = (object)null;

                    try
                    {
                        connection = connectionManager.AcquireConnection(null);

                        string filePath = connection.ToString();

                        cloudBlob.DownloadToFile(filePath, FileMode.Create);
                    }
                    finally
                    {
                        if (connection != null && connectionManager != null)
                            connectionManager.ReleaseConnection(null);
                    }
                }
                else if (_outputDestination == DestinationType.Variable)
                {
                    var variables = (Variables)null;
                    _variableDispenser.LockOneForWrite(_destination, ref variables);

                    try
                    {
                        var variable = variables[_destination];

                        if (variable != null)
                        {
                            variable.Value = cloudBlob.DownloadText();
                        }
                    }
                    finally
                    {
                        if (variables != null)
                            variables.Unlock();
                    }
                }

                _componentEvents.FireInformation(0, "ExecuteAzureMLBatch",
                    string.Format("The result '{0}' is available: BaseLocation: '{1}' RelativeLocation: '{2}' SasBlobToken: '{3}'",
                        key,
                        blobLocation.BaseLocation,
                        blobLocation.RelativeLocation,
                        blobLocation.SasBlobToken),
                    null, 0, ref fireAgain);
            }
        }
開發者ID:IgnEriol,項目名稱:AzureMLSSIS,代碼行數:56,代碼來源:ExecuteAzureMLBatch.cs


注:本文中的Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob.DownloadToFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。