IOption
IOption is root interface filesystem options.
/// <summary>
/// Interface for filesystem options.
///
/// See sub-interfaces:
/// <list type="bullet">
/// <item><see cref="IAdaptableOption"/></item>
/// <item><see cref="ISubPathOption"/></item>
/// <item><see cref="IPathInfo"/></item>
/// <item><see cref="IAutoMountOption"/></item>
/// <item><see cref="IToken"/></item>
/// <item><see cref="IOpenOption"/></item>
/// <item><see cref="IObserveOption"/></item>
/// <item><see cref="IMoveOption"/></item>
/// <item><see cref="IBrowseOption"/></item>
/// <item><see cref="ICreateDirectoryOption"/></item>
/// <item><see cref="IDeleteOption"/></item>
/// <item><see cref="IMountOption"/></item>
/// </list>
///
/// The options properties must be immutable in the implementing classes.
/// </summary>
public interface IOption
{
}
IOpenOption is capabilities of IFileSystemOpen interface.
IObserveOption is capabilities of IFileSystemObserve interface.
/// <summary>File system option for observe.</summary>
[Operations<ObserverOptionOperations>]
public interface IObserveOption : IOption
{
/// <summary>Has Observe capability.</summary>
bool CanObserve { get; }
}
IMoveOption is capabilities of IFileSystemMove interface.
/// <summary>File system option for move/rename.</summary>
[Operations<MoveOptionOperations>]
public interface IMoveOption : IOption
{
/// <summary>Can Move files within same volume.</summary>
bool CanMove { get; }
}
IBrowseOption is capabilities of IFileSystemBrowse interface.
/// <summary>File system options for browse.</summary>
[Operations<BrowseOptionOperations>]
public interface IBrowseOption : IOption
{
/// <summary>Has Browse capability.</summary>
bool CanBrowse { get; }
/// <summary>Has GetEntry capability.</summary>
bool CanGetEntry { get; }
}
ICreateDirectoryOption is capabilities of IFileSystemCreateDirectory interface.
/// <summary>File system option for creating directories.</summary>
[Operations<CreateDirectoryOptionOperations>]
public interface ICreateDirectoryOption : IOption
{
/// <summary>Has CreateDirectory capability.</summary>
bool CanCreateDirectory { get; }
}
IDeleteOption is capabilities of IFileSystemDelete interface.
/// <summary>File system option for deleting files and directories.</summary>
[Operations<DeleteOptionOperations>]
public interface IDeleteOption : IOption
{
/// <summary>Has Delete capability.</summary>
bool CanDelete { get; }
}
IMountOption is capabilities of IFileSystemMount interface.
// Copyright (c) Toni Kalajainen 2022
namespace Avalanche.FileSystem;
// <docs>
/// <summary>File system option for mount capabilities. Used with <see cref="IFileSystemMount"/>.</summary>
[Operations<MountOptionOperations>]
public interface IMountOption : IOption
{
/// <summary>Can filesystem mount other filesystems.</summary>
bool CanMount { get; }
/// <summary>Is filesystem allowed to unmount a mount.</summary>
bool CanUnmount { get; }
/// <summary>Is filesystem allowed to list mountpoints.</summary>
bool CanListMountPoints { get; }
}
// </docs
IFileAttributeOption is capabilities of IFileSystemFileAttribute interface.
/// <summary>File system options for browse.</summary>
[Operations<FileAttributeOptionOperations>]
public interface IFileAttributeOption : IOption
{
/// <summary>Has SetFileAttribute capability.</summary>
bool CanSetFileAttribute { get; }
}
ISubPathOption is interface for subpath option.
/// <summary>Option for mount path. Use with decorator.</summary>
[Operations<SubPathOptionOperations>]
public interface ISubPathOption : IOption
{
/// <summary>Sub-path.</summary>
String? SubPath { get; }
}
IAutoMountOption is interface for automatic mounting of package files.
/// <summary>Option for auto-mounted packages.</summary>
[Operations<AutoMountOptionOperations>]
public interface IAutoMountOption : IOption
{
/// <summary>Package loaders that can mount package files, such as .zip.</summary>
IPackageLoader[] AutoMounters { get; }
}
IPathInfo is interface for filesystem's path info options.
/// <summary>Path related options</summary>
[Operations<FileSystemOptionOperationPath>]
public interface IPathInfo : IOption
{
/// <summary>Case sensitivity</summary>
FileSystemCaseSensitivity CaseSensitivity { get; }
/// <summary>Filesystem allows empty string "" directory names. The value of this property excludes the default empty "" root path.</summary>
bool EmptyDirectoryName { get; }
}
IAdaptableOption is interface for runtime option classes.
/// <summary>
/// Interface for option classes that adapt to option types at runtime.
/// Also enumerates supported <see cref="IOption"/> option type interfaces.
/// </summary>
public interface IAdaptableOption : IOption, IEnumerable<KeyValuePair<Type, IOption>>
{
/// <summary>Get option with type interface.</summary>
/// <param name="optionInterfaceType">Subtype of <see cref="IOption"/></param>
/// <returns>Option or null</returns>
IOption? GetOption(Type optionInterfaceType);
}
FileSystemOption singletons:
Flag | Description |
---|---|
Option.Join() | Takes first instance of each option. |
Option.Union() | Take union of options. |
Option.Intersection() | Take intersection of options. |
Option.ReadOnly | Read-only operations allowed, deny modification and write operations |
Option.NoOptions | No options |
Option.Path(caseSensitivity, emptyDirectoryName) | Path options |
Option.Observe | Observe is allowed. |
Option.NoObserve | Observe is not allowed |
Option.Open(canOpen, canRead, canWrite, canCreateFile) | Open options |
Option.OpenReadWriteCreate | Open, Read, Write, Create |
Option.OpenReadWrite | Open, Read, Write |
Option.OpenRead | Open, Read |
Option.NoOpen | No access |
Option.Mount | Mount is allowed. |
Option.NoMount | Mount is not allowed |
Option.Move | Move and rename is allowed. |
Option.NoMove | Move and rename not allowed. |
Option.Delete | Delete allowed. |
Option.NoDelete | Delete not allowed. |
Option.CreateDirectory | CreateDirectory allowed. |
Option.NoCreateDirectory | CreateDirectory not allowed. |
Option.Browse | Browse allowed. |
Option.NoBrowse | Browse not allowed. |
Option.SubPath(subpath) | Create option for sub-path. Used with decorator and VirtualFileSystem. |
Option.NoSubPath | No mount path. |