public BlobContainer(string name, FileSystemItemBase parent, CloudBlobContainer blobContainer, DateTimeOffset?lastWriteTime)
            : base(name, parent)
        {
            if (lastWriteTime != null)
            {
                LastWriteTime = lastWriteTime.Value.ToLocalTime().DateTime;
            }

            CloudBlobContainer = blobContainer;
        }
        public BlobItem(string name, FileSystemItemBase parent, ICloudBlob blob)
            : base(name, parent)
        {
            if (blob.Properties.LastModified != null)
            {
                LastWriteTime = blob.Properties.LastModified.Value.ToLocalTime().DateTime;
            }

            FileSize  = blob.Properties.Length;
            CloudBlob = blob;
            CloudBlob.ServiceClient.DefaultRequestOptions.RetryPolicy = new RetryPolicyCancellationWrapper(CloudBlob.ServiceClient.DefaultRequestOptions.RetryPolicy);
        }
示例#3
0
 /// <summary>
 /// Returns false if item was not found;
 /// </summary>
 public bool TryGetItemByPath(string path, out FileSystemItemBase item)
 {
     try
     {
         item = GetItemByPath(path);
         return(true);
     }
     catch (MissingMemberException)
     {
         item = null;
         return(false);
     }
 }
示例#4
0
        public FileSystemItemBase GetItemByPath(string path)
        {
            if (path == "\\")
            {
                return(instance);
            }
            var levels = path.Split(new[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);

            FileSystemItemBase currentItem = instance;

            foreach (string level in levels)
            {
                currentItem = currentItem[level];
                if (currentItem == null)
                {
                    throw new MissingMemberException(String.Format("Invalid operation: Node {0} is missing in path '{1}' ", level, path));
                }
            }
            return(currentItem);
        }
 public StorageAccount(string name, FileSystemItemBase parent, CloudBlobClient blobClient) : base(name, parent)
 {
     BlobClient = blobClient;
     //Allow cancellation for Blob operations;
     BlobClient.DefaultRequestOptions.RetryPolicy = new RetryPolicyCancellationWrapper(BlobClient.DefaultRequestOptions.RetryPolicy);
 }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the FileSystemItem class.
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="name"></param>
 public FileSystemItemBase(string name, FileSystemItemBase parent, DateTime?LastWriteTime = null)
 {
     Parent        = parent;
     Name          = name;
     LastWriteTime = null;
 }
 public BlobDirectory(string name, FileSystemItemBase parent, CloudBlobDirectory cloudBlobDirectory)
     : base(name, parent)
 {
     CloudBlobDirectory = cloudBlobDirectory;
 }
 /// <summary>
 /// Initializes a new instance of the NewAccountSupportFile class.
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="name"></param>
 public NewAccountSupportFile(string name, FileSystemItemBase parent)
     : base(name, parent)
 {
 }