Beispiel #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;
        }
Beispiel #2
0
 protected internal override FileSystemStream DoGetMetadataStream(FileSystemSessionItem item, Action<FileSystemStream> disposeAction)
 {
     throw new NotImplementedException();
 }
Beispiel #3
0
 protected internal override DateTime? DoGetModificationTimestamp(FileSystemSessionItem item)
 {
     return _metadataStore.GetItemModificationTimestamp(item.Path, 5);
 }
Beispiel #4
0
 protected internal override void DoDeleteItem(FileSystemSessionItem item)
 {
     _fileStore.Delete(item.Path, 5);
 }
Beispiel #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)));
 }
Beispiel #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)));
 }
Beispiel #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)));
 }
Beispiel #8
0
 protected FileSystemStream(FileSystemSessionItem item, Action<FileSystemStream> disposeAction)
 {
   Item = item;
   m_DisposeAction = disposeAction;
 }
Beispiel #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);
Beispiel #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);
Beispiel #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)));
 }
Beispiel #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);
Beispiel #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);
Beispiel #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);
Beispiel #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);
Beispiel #16
0
 protected internal override void DoSetLastAccessTimestamp(FileSystemSessionItem item, DateTime timestamp)
 {
     throw new NotImplementedException();
 }
Beispiel #17
0
 protected internal override void DoSetReadOnly(FileSystemSessionItem item, bool readOnly)
 {
     throw new NotImplementedException();
 }
Beispiel #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)));
 }
Beispiel #19
0
 /// <summary>
 /// Override to delete item.
 /// This method may be called by miltiple threads
 /// </summary>
 protected internal abstract void DoDeleteItem(FileSystemSessionItem item);
Beispiel #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);
 }
Beispiel #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);
Beispiel #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);
 }
Beispiel #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);
Beispiel #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)));
 }
Beispiel #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);
        }
Beispiel #26
0
 protected FileSystemStream(FileSystemSessionItem item, Action <FileSystemStream> disposeAction)
 {
     Item            = item;
     m_DisposeAction = disposeAction;
 }
Beispiel #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);
        }
Beispiel #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)
 {
 }
Beispiel #29
0
 protected internal override bool DoRenameItem(FileSystemSessionItem item, string newName)
 {
     throw new NotImplementedException();
 }
Beispiel #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)));
 }
Beispiel #31
0
 protected internal override DateTime? DoGetLastAccessTimestamp(FileSystemSessionItem item)
 {
     throw new NotImplementedException();
 }
Beispiel #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)
 {
 }
Beispiel #33
0
 protected internal override bool DoGetReadOnly(FileSystemSessionItem item)
 {
     return false;
 }
Beispiel #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);
Beispiel #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;
          }
        }
Beispiel #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)));
 }