Example #1
0
        public DropBoxFileStream(FileSystemSessionItem item, Action<FileSystemStream> disposeAction)
            : base(item, disposeAction)
        {
            DropBoxFileSystemSession session = item.Session as DropBoxFileSystemSession;
            if(session == null)
                throw new NFXException(StringConsts.FS_STREAM_BAD_TYPE_ERROR + GetType() + ".ctor_DropBoxFileSystemSession");

            _fileStore = new DropBoxFileStore(session.ConnectParameters);
            _metadataStore = new DropBoxMetadataStore(session.ConnectParameters);
            _item = item;
        }
Example #2
0
 protected internal override FileSystemStream DoGetMetadataStream(FileSystemSessionItem item, Action<FileSystemStream> disposeAction)
 {
     throw new NotImplementedException();
 }
Example #3
0
 protected internal override DateTime? DoGetModificationTimestamp(FileSystemSessionItem item)
 {
     return _metadataStore.GetItemModificationTimestamp(item.Path, 5);
 }
Example #4
0
 protected internal override void DoDeleteItem(FileSystemSessionItem item)
 {
     _fileStore.Delete(item.Path, 5);
 }
Example #5
0
 /// <summary>
 /// Async version of <see cref="DoGetMetadataStream(FileSystemSessionItem, Action{FileSystemStream})"/>.
 /// This base/default implementation just synchronously calls <see cref="DoGetMetadataStream(FileSystemSessionItem, Action{FileSystemStream})"/> and
 /// returns already completed Task with result returned by <see cref="DoGetMetadataStream(FileSystemSessionItem, Action{FileSystemStream})"/>
 /// </summary>
 protected internal virtual Task <FileSystemStream> DoGetMetadataStreamAsync(FileSystemSessionItem item, Action <FileSystemStream> disposeAction)
 {
     return(TaskUtils.AsCompletedTask(() => DoGetMetadataStream(item, disposeAction)));
 }
Example #6
0
 /// <summary>
 /// Async version of <see cref="DoGetItemSize(FileSystemSessionItem)"/>.
 /// This base/default implementation just synchronously calls <see cref="DoGetItemSize(FileSystemSessionItem)"/> and
 /// returns already completed Task with result returned by <see cref="DoGetItemSize(FileSystemSessionItem)"/>
 /// </summary>
 protected internal virtual Task <ulong> DoGetItemSizeAsync(FileSystemSessionItem item)
 {
     return(TaskUtils.AsCompletedTask(() => DoGetItemSize(item)));
 }
Example #7
0
 /// <summary>
 /// Async version of <see cref="DoDeleteItem(FileSystemSessionItem)"/>.
 /// This base/default implementation just synchronously calls <see cref="DoDeleteItem(FileSystemSessionItem)"/> and
 /// returns already completed Task with result returned by <see cref="DoDeleteItem(FileSystemSessionItem)"/>
 /// </summary>
 protected internal virtual Task DoDeleteItemAsync(FileSystemSessionItem item)
 {
     return(TaskUtils.AsCompletedTask(() => DoDeleteItem(item)));
 }
Example #8
0
 protected FileSystemStream(FileSystemSessionItem item, Action<FileSystemStream> disposeAction)
 {
   Item = item;
   m_DisposeAction = disposeAction;
 }
Example #9
0
 /// <summary>
 /// Override to set item readonly status.
 /// This method may be called by miltiple threads
 /// </summary>
 protected internal abstract void DoSetReadOnly(FileSystemSessionItem item, bool readOnly);
Example #10
0
 /// <summary>
 /// Override to get item readonly status.
 /// This method may be called by miltiple threads
 /// </summary>
 protected internal abstract bool DoGetReadOnly(FileSystemSessionItem item);
Example #11
0
 /// <summary>
 /// Async version of <see cref="DoSetLastAccessTimestamp(FileSystemSessionItem, DateTime)"/>.
 /// This base/default implementation just synchronously calls <see cref="DoSetLastAccessTimestamp(FileSystemSessionItem, DateTime)"/> and
 /// returns already completed Task with result returned by <see cref="DoSetLastAccessTimestamp(FileSystemSessionItem, DateTime)"/>
 /// </summary>
 protected internal virtual Task DoSetLastAccessTimestampAsync(FileSystemSessionItem item, DateTime timestamp)
 {
     return(TaskUtils.AsCompletedTask(() => DoSetLastAccessTimestamp(item, timestamp)));
 }
Example #12
0
 /// <summary>
 /// Override to set item last access timestamp.
 /// This method may be called by miltiple threads
 /// </summary>
 protected internal abstract void DoSetLastAccessTimestamp(FileSystemSessionItem item, DateTime timestamp);
Example #13
0
 /// <summary>
 /// Override to set item modification timestamp.
 /// This method may be called by miltiple threads
 /// </summary>
 protected internal abstract void DoSetModificationTimestamp(FileSystemSessionItem item, DateTime timestamp);
Example #14
0
 /// <summary>
 /// Override to get item last access timestamp.
 /// This method may be called by miltiple threads
 /// </summary>
 protected internal abstract DateTime?DoGetLastAccessTimestamp(FileSystemSessionItem item);
Example #15
0
 /// <summary>
 /// Override to get item modification timestamp.
 /// This method may be called by miltiple threads
 /// </summary>
 protected internal abstract DateTime?DoGetModificationTimestamp(FileSystemSessionItem item);
Example #16
0
 protected internal override void DoSetLastAccessTimestamp(FileSystemSessionItem item, DateTime timestamp)
 {
     throw new NotImplementedException();
 }
Example #17
0
 protected internal override void DoSetReadOnly(FileSystemSessionItem item, bool readOnly)
 {
     throw new NotImplementedException();
 }
Example #18
0
 /// <summary>
 /// Async version of <see cref="DoSetReadOnly(FileSystemSessionItem, bool)"/>.
 /// This base/default implementation just synchronously calls <see cref="DoSetReadOnly(FileSystemSessionItem, bool)"/> and
 /// returns already completed Task with result returned by <see cref="DoSetReadOnly(FileSystemSessionItem, bool)"/>
 /// </summary>
 protected internal virtual Task DoSetReadOnlyAsync(FileSystemSessionItem item, bool readOnly)
 {
     return(TaskUtils.AsCompletedTask(() => DoSetReadOnly(item, readOnly)));
 }
Example #19
0
 /// <summary>
 /// Override to delete item.
 /// This method may be called by miltiple threads
 /// </summary>
 protected internal abstract void DoDeleteItem(FileSystemSessionItem item);
Example #20
0
 /// <summary>
 /// Override in particular file systems to get user who was the last user modifying the item.
 /// This method may be called by miltiple threads
 /// </summary>
 protected internal virtual User  DoGetModificationUser(FileSystemSessionItem item)
 {
     return(User.Fake);
 }
Example #21
0
 /// <summary>
 /// Override to get the byte size of item (directory or file).
 /// This method may be called by miltiple threads
 /// </summary>
 protected internal abstract ulong DoGetItemSize(FileSystemSessionItem item);
Example #22
0
 /// <summary>
 /// Override in particular file systems to get user who was the last user accessing the item.
 /// This method may be called by miltiple threads
 /// </summary>
 protected internal virtual User  DoGetLastAccessUser(FileSystemSessionItem item)
 {
     return(User.Fake);
 }
Example #23
0
 /// <summary>
 /// Override to get metadata stream for item (directory or file).
 /// This method may be called by miltiple threads
 /// </summary>
 protected internal abstract FileSystemStream DoGetMetadataStream(FileSystemSessionItem item, Action <FileSystemStream> disposeAction);
Example #24
0
 /// <summary>
 /// Async version of <see cref="DoGetLastAccessUser(FileSystemSessionItem)"/>.
 /// This base/default implementation just synchronously calls <see cref="DoGetLastAccessUser(FileSystemSessionItem)"/> and
 /// returns already completed Task with result returned by <see cref="DoGetLastAccessUser(FileSystemSessionItem)"/>
 /// </summary>
 protected internal virtual Task <User> DoGetLastAccessUserAsync(FileSystemSessionItem item)
 {
     return(TaskUtils.AsCompletedTask(() => DoGetLastAccessUser(item)));
 }
Example #25
0
        private static void PrintItemInfo(FileSystemSessionItem item)
        {
            Console.WriteLine("Name:\t\t\t{0}", item.Name);
            Console.WriteLine("Size:\t\t\t{0}", item.Size);
            Console.WriteLine("Path:\t\t\t{0}", item.Path);
            Console.WriteLine("Parent:\t\t\t{0}", item.ParentPath);

            Console.WriteLine("IsReadOnly:\t\t{0}", item.IsReadOnly);
            Console.WriteLine("CreationUser:\t\t{0}", item.CreationUser);
            Console.WriteLine("CreationTimestamp:\t{0}", item.CreationTimestamp);

            Console.WriteLine("LastAccessUser:\t\t{0}: ", item.LastAccessUser);

            Console.WriteLine("Modified: {0}\t\t", item.Modified);
            Console.WriteLine("ModificationTimestamp:\t{0}", item.ModificationTimestamp);
            Console.WriteLine("ModificationUser:\t{0}", item.ModificationUser);
        }
Example #26
0
 protected FileSystemStream(FileSystemSessionItem item, Action <FileSystemStream> disposeAction)
 {
     Item            = item;
     m_DisposeAction = disposeAction;
 }
Example #27
0
        protected internal override ulong DoGetItemSize(FileSystemSessionItem item)
        {
            if (item is FileSystemFile)
                return _metadataStore.GetFileSize(item.Path, 5);

            return _metadataStore.GetFolderSize(item.Path, 5);
        }
Example #28
0
 /// <summary>
 /// Override in particular file systems to see if item can change, i.e.
 ///  for file systems that support versioning throw exception if item is in session
 ///   which "looks" at a sealed/closed version and can not change. This method may be called by miltiple threads
 /// </summary>
 protected internal virtual void DoCheckCanChange(FileSystemSessionItem item)
 {
 }
Example #29
0
 protected internal override bool DoRenameItem(FileSystemSessionItem item, string newName)
 {
     throw new NotImplementedException();
 }
Example #30
0
 /// <summary>
 /// Async version of <see cref="DoCheckCanChange(FileSystemSessionItem)"/>.
 /// This base/default implementation just synchronously calls <see cref="DoCheckCanChange(FileSystemSessionItem)"/> and
 /// returns already completed Task with result returned by <see cref="DoCheckCanChange(FileSystemSessionItem)"/>
 /// </summary>
 protected internal virtual Task DoCheckCanChangeAsync(FileSystemSessionItem item)
 {
     return(TaskUtils.AsCompletedTask(() => DoCheckCanChange(item)));
 }
Example #31
0
 protected internal override DateTime? DoGetLastAccessTimestamp(FileSystemSessionItem item)
 {
     throw new NotImplementedException();
 }
Example #32
0
 /// <summary>
 /// Override to refresh item state, i.e. re-fetch remote information.
 /// This method may be called by miltiple threads
 /// </summary>
 protected internal virtual void DoRefresh(FileSystemSessionItem item)
 {
 }
Example #33
0
 protected internal override bool DoGetReadOnly(FileSystemSessionItem item)
 {
     return false;
 }
Example #34
0
 /// <summary>
 /// Override to rename item return true on success.
 /// This method may be called by miltiple threads
 /// </summary>
 protected internal abstract bool DoRenameItem(FileSystemSessionItem item, string newName);
Example #35
0
        }//deepCopyTo

        private void copyCommonAttributes(FileSystemSessionItem source, FileSystemSessionItem target, byte[] buffer, DirCopyFlags flags)
        {
          if (flags.HasFlag(DirCopyFlags.Security) &&
              this.FileSystem.InstanceCapabilities.SupportsSecurity &&
              target.FileSystem.InstanceCapabilities.SupportsSecurity) copyStream(source.PermissionsStream, target.PermissionsStream, buffer);

          if (flags.HasFlag(DirCopyFlags.Metadata) &&
              this.FileSystem.InstanceCapabilities.SupportsCustomMetadata &&
              target.FileSystem.InstanceCapabilities.SupportsCustomMetadata) copyStream(source.MetadataStream, target.MetadataStream, buffer);
          
          if (flags.HasFlag(DirCopyFlags.Timestamps))
          {         
            if (this.FileSystem.InstanceCapabilities.SupportsCreationTimestamps &&
                target.FileSystem.InstanceCapabilities.SupportsCreationTimestamps) target.CreationTimestamp = source.CreationTimestamp;

            if (this.FileSystem.InstanceCapabilities.SupportsModificationTimestamps &&
                target.FileSystem.InstanceCapabilities.SupportsModificationTimestamps) target.ModificationTimestamp = source.ModificationTimestamp;

            if (this.FileSystem.InstanceCapabilities.SupportsLastAccessTimestamps &&
                target.FileSystem.InstanceCapabilities.SupportsLastAccessTimestamps) target.LastAccessTimestamp = source.LastAccessTimestamp;
          }
        }
Example #36
0
 /// <summary>
 /// Async version of <see cref="DoRenameItem(FileSystemSessionItem, string)"/>.
 /// This base/default implementation just synchronously calls <see cref="DoRenameItem(FileSystemSessionItem, string)"/> and
 /// returns already completed Task with result returned by <see cref="DoRenameItem(FileSystemSessionItem, string)"/>
 /// </summary>
 protected internal virtual Task <bool> DoRenameItemAsync(FileSystemSessionItem item, string newName)
 {
     return(TaskUtils.AsCompletedTask(() => DoRenameItem(item, newName)));
 }