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; }
protected internal override FileSystemStream DoGetMetadataStream(FileSystemSessionItem item, Action<FileSystemStream> disposeAction) { throw new NotImplementedException(); }
protected internal override DateTime? DoGetModificationTimestamp(FileSystemSessionItem item) { return _metadataStore.GetItemModificationTimestamp(item.Path, 5); }
protected internal override void DoDeleteItem(FileSystemSessionItem item) { _fileStore.Delete(item.Path, 5); }
/// <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))); }
/// <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))); }
/// <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))); }
protected FileSystemStream(FileSystemSessionItem item, Action<FileSystemStream> disposeAction) { Item = item; m_DisposeAction = disposeAction; }
/// <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);
/// <summary> /// Override to get item readonly status. /// This method may be called by miltiple threads /// </summary> protected internal abstract bool DoGetReadOnly(FileSystemSessionItem item);
/// <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))); }
/// <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);
/// <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);
/// <summary> /// Override to get item last access timestamp. /// This method may be called by miltiple threads /// </summary> protected internal abstract DateTime?DoGetLastAccessTimestamp(FileSystemSessionItem item);
/// <summary> /// Override to get item modification timestamp. /// This method may be called by miltiple threads /// </summary> protected internal abstract DateTime?DoGetModificationTimestamp(FileSystemSessionItem item);
protected internal override void DoSetLastAccessTimestamp(FileSystemSessionItem item, DateTime timestamp) { throw new NotImplementedException(); }
protected internal override void DoSetReadOnly(FileSystemSessionItem item, bool readOnly) { throw new NotImplementedException(); }
/// <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))); }
/// <summary> /// Override to delete item. /// This method may be called by miltiple threads /// </summary> protected internal abstract void DoDeleteItem(FileSystemSessionItem item);
/// <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); }
/// <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);
/// <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); }
/// <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);
/// <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))); }
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); }
protected FileSystemStream(FileSystemSessionItem item, Action <FileSystemStream> disposeAction) { Item = item; m_DisposeAction = disposeAction; }
protected internal override ulong DoGetItemSize(FileSystemSessionItem item) { if (item is FileSystemFile) return _metadataStore.GetFileSize(item.Path, 5); return _metadataStore.GetFolderSize(item.Path, 5); }
/// <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) { }
protected internal override bool DoRenameItem(FileSystemSessionItem item, string newName) { throw new NotImplementedException(); }
/// <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))); }
protected internal override DateTime? DoGetLastAccessTimestamp(FileSystemSessionItem item) { throw new NotImplementedException(); }
/// <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) { }
protected internal override bool DoGetReadOnly(FileSystemSessionItem item) { return false; }
/// <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);
}//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; } }
/// <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))); }