本文整理汇总了C#中FileNode.GetLocalRelativePath方法的典型用法代码示例。如果您正苦于以下问题:C# FileNode.GetLocalRelativePath方法的具体用法?C# FileNode.GetLocalRelativePath怎么用?C# FileNode.GetLocalRelativePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileNode
的用法示例。
在下文中一共展示了FileNode.GetLocalRelativePath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WaitUntilFileCreated
public static void WaitUntilFileCreated(string rootPath, FileNode fileNode, DataAdaptor<DMLibDataInfo> dataAdaptor, DMLibDataType dataType, int timeoutInSec = 300)
{
Func<bool> checkFileCreated = null;
if (dataType == DMLibDataType.Local)
{
string filePath = dataAdaptor.GetAddress() + fileNode.GetLocalRelativePath();
checkFileCreated = () =>
{
return File.Exists(filePath);
};
}
else if (dataType == DMLibDataType.PageBlob ||
dataType == DMLibDataType.AppendBlob)
{
CloudBlobDataAdaptor blobAdaptor = dataAdaptor as CloudBlobDataAdaptor;
checkFileCreated = () =>
{
CloudBlob cloudBlob = blobAdaptor.GetCloudBlobReference(rootPath, fileNode);
return cloudBlob.Exists(options: HelperConst.DefaultBlobOptions);
};
}
else if (dataType == DMLibDataType.BlockBlob)
{
CloudBlobDataAdaptor blobAdaptor = dataAdaptor as CloudBlobDataAdaptor;
checkFileCreated = () =>
{
CloudBlockBlob blockBlob = blobAdaptor.GetCloudBlobReference(rootPath, fileNode) as CloudBlockBlob;
try
{
return blockBlob.DownloadBlockList(BlockListingFilter.All, options: HelperConst.DefaultBlobOptions).Any();
}
catch (StorageException)
{
return false;
}
};
}
else if (dataType == DMLibDataType.CloudFile)
{
CloudFileDataAdaptor fileAdaptor = dataAdaptor as CloudFileDataAdaptor;
checkFileCreated = () =>
{
CloudFile cloudFile = fileAdaptor.GetCloudFileReference(rootPath, fileNode);
return cloudFile.Exists(options: HelperConst.DefaultFileOptions);
};
}
else
{
Test.Error("Unexpected data type: {0}", DMLibTestContext.SourceType);
}
MultiDirectionTestHelper.WaitUntil(checkFileCreated, timeoutInSec);
}