本文整理汇总了C#中net.openstack.Providers.Rackspace.CloudFilesProvider.GetObjectSaveToFile方法的典型用法代码示例。如果您正苦于以下问题:C# CloudFilesProvider.GetObjectSaveToFile方法的具体用法?C# CloudFilesProvider.GetObjectSaveToFile怎么用?C# CloudFilesProvider.GetObjectSaveToFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.openstack.Providers.Rackspace.CloudFilesProvider
的用法示例。
在下文中一共展示了CloudFilesProvider.GetObjectSaveToFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DownloadFromRackSpaceCloudFiles
public bool DownloadFromRackSpaceCloudFiles()
{
bool syncSucceeded = true;
try
{
var cloudIdentity = new CloudIdentity() { APIKey = this.apiKey, Username = this.username };
var cloudFilesProvider = new CloudFilesProvider(cloudIdentity);
IEnumerable<ContainerObject> containerObjectList = cloudFilesProvider.ListObjects(container);
foreach (ContainerObject containerObject in containerObjectList)
{
cloudFilesProvider.GetObjectSaveToFile(container, localSource, containerObject.Name, containerObject.Name);
}
}
catch (Exception e)
{
Console.WriteLine("Exception in downloading from rackspace: " + e);
syncSucceeded = false;
}
return syncSucceeded;
}
示例2: Should_Get_Object_And_Save_To_File_Without_Headers_And_Verify_Etag
public void Should_Get_Object_And_Save_To_File_Without_Headers_And_Verify_Etag()
{
string filePath = Path.Combine(Directory.GetCurrentDirectory(), objectName);
string fileName = Path.GetFileName(filePath);
var headers = new Dictionary<string, string>();
var provider = new CloudFilesProvider();
provider.GetObjectSaveToFile(containerName, saveDirectory, fileName, null, 65536, null, null, true, identity: _testIdentity);
}
示例3: Should_Get_Object_And_Save_To_File_Without_Headers_And_Verify_Etag
public void Should_Get_Object_And_Save_To_File_Without_Headers_And_Verify_Etag()
{
var provider = new CloudFilesProvider(_testIdentity);
provider.GetObjectSaveToFile(containerName, Directory.GetCurrentDirectory(), objectName, saveFileNane2, verifyEtag: true);
}
示例4: TestGetObjectSaveToFile
public void TestGetObjectSaveToFile()
{
IObjectStorageProvider provider = new CloudFilesProvider(Bootstrapper.Settings.TestIdentity);
string containerName = TestContainerPrefix + Path.GetRandomFileName();
string objectName = Path.GetRandomFileName();
// another random name counts as random content
string fileData = Path.GetRandomFileName();
ObjectStore containerResult = provider.CreateContainer(containerName);
Assert.AreEqual(ObjectStore.ContainerCreated, containerResult);
using (MemoryStream uploadStream = new MemoryStream(Encoding.UTF8.GetBytes(fileData)))
{
provider.CreateObject(containerName, uploadStream, objectName);
}
try
{
provider.GetObjectSaveToFile(containerName, Path.GetTempPath(), objectName);
Assert.AreEqual(fileData, File.ReadAllText(Path.Combine(Path.GetTempPath(), objectName), Encoding.UTF8));
// it's ok to download the same file twice
ProgressMonitor progressMonitor = new ProgressMonitor(GetContainerObjectSize(provider, containerName, objectName));
provider.GetObjectSaveToFile(containerName, Path.GetTempPath(), objectName, progressUpdated: progressMonitor.Updated);
Assert.IsTrue(progressMonitor.IsComplete, "Failed to notify progress monitor callback of status update.");
}
finally
{
File.Delete(Path.Combine(Path.GetTempPath(), objectName));
}
string tempFileName = Path.GetRandomFileName();
try
{
provider.GetObjectSaveToFile(containerName, Path.GetTempPath(), objectName, tempFileName);
Assert.AreEqual(fileData, File.ReadAllText(Path.Combine(Path.GetTempPath(), tempFileName), Encoding.UTF8));
// it's ok to download the same file twice
ProgressMonitor progressMonitor = new ProgressMonitor(GetContainerObjectSize(provider, containerName, objectName));
provider.GetObjectSaveToFile(containerName, Path.GetTempPath(), objectName, progressUpdated: progressMonitor.Updated);
Assert.IsTrue(progressMonitor.IsComplete, "Failed to notify progress monitor callback of status update.");
}
finally
{
File.Delete(Path.Combine(Path.GetTempPath(), tempFileName));
}
/* Cleanup
*/
provider.DeleteContainer(containerName, deleteObjects: true);
}