示例#1
0
        public async Task <IUnixFileSystemEntry> GetEntryByNameAsync(IUnixDirectoryEntry directoryEntry, string name, CancellationToken cancellationToken)
        {
            var dir = (CloudBlobDirectory)((AzureBlobDirectoryEntry)directoryEntry).Item;

            foreach (IListBlobItem item in dir.ListBlobs())
            {
                if (item.GetType() == typeof(CloudBlockBlob))
                {
                    CloudBlockBlob blob = (CloudBlockBlob)item;
                    var            abf  = new AzureBlobFileEntry(this, blob, blob.Properties.Length);
                    if (abf.Name == name)
                    {
                        return((IUnixFileSystemEntry)abf);
                    }
                }
                else if (item.GetType() == typeof(CloudBlobDirectory))
                {
                    CloudBlobDirectory directory = (CloudBlobDirectory)item;
                    var abd = new AzureBlobDirectoryEntry(this, directory, false);
                    if (abd.Name == name)
                    {
                        return((IUnixFileSystemEntry)abd);
                    }
                }
            }
            return(null);
        }
示例#2
0
 public AzureBlobFileSystem(CloudBlobContainer container, string userId)
 {
     Container = container;
     CreateAzureBlobDirectory("FTPROOT");
     Root = new AzureBlobDirectoryEntry(this, Container.GetDirectoryReference("FTPROOT"), true);
 }