Class DatabaseFileProvider
public sealed class DatabaseFileProvider : VirtualFileProviderBase, IVirtualFileProvider, IDisposable
- Inheritance
-
DatabaseFileProvider
- Implements
- Inherited Members
- Extension Methods
Constructors
DatabaseFileProvider(IContentIndexMap, ObjectDatabase, string)
public DatabaseFileProvider(IContentIndexMap contentIndexMap, ObjectDatabase objectDatabase, string mountPoint = null)
Parameters
contentIndexMapIContentIndexMapobjectDatabaseObjectDatabasemountPointstring
DatabaseFileProvider(ObjectDatabase, string)
public DatabaseFileProvider(ObjectDatabase objectDatabase, string mountPoint = null)
Parameters
objectDatabaseObjectDatabasemountPointstring
Fields
ObjectIdUrl
URL prefix for ObjectId references.
public static readonly string ObjectIdUrl
Field Value
Properties
ContentIndexMap
public IContentIndexMap ContentIndexMap { get; }
Property Value
ObjectDatabase
public ObjectDatabase ObjectDatabase { get; }
Property Value
Methods
CreateRegexForFileSearch(string, string, VirtualSearchOption)
public static Regex CreateRegexForFileSearch(string url, string searchPattern, VirtualSearchOption searchOption)
Parameters
urlstringsearchPatternstringsearchOptionVirtualSearchOption
Returns
FileExists(string)
Determines whether the specified path points to an existing file.
public override bool FileExists(string url)
Parameters
urlstringThe path.
Returns
FileSize(string)
Returns the size of the specified file in bytes
public override long FileSize(string url)
Parameters
urlstringThe file or directory for which to obtain size
Returns
- long
A long value representing the file size in bytes
GetAbsolutePath(string)
Gets the absolute path for the specified local path from this provider.
public override string GetAbsolutePath(string url)
Parameters
urlstring
Returns
- string
An absolute path.
ListFiles(string, string, VirtualSearchOption)
Returns the list of files from the specified path.
public override string[] ListFiles(string url, string searchPattern, VirtualSearchOption searchOption)
Parameters
urlstringThe url (without preceding slash).
searchPatternstringThe search string to match against the names of files in
path. This parameter can contain a combination of valid literal path and wildcard (* and ?) characters, but it doesn't support regular expressions.searchOptionVirtualSearchOptionOne of the enumeration values that specifies whether the search operation should include all subdirectories or only the current directory.
Returns
- string[]
A list of files from the specified path
Remarks
Example: to get all files within a directory ListFiles("path/to/folder", "*", VirtualSearchOption.TopDirectoryOnly)
OpenStream(string, VirtualFileMode, VirtualFileAccess, VirtualFileShare, StreamFlags)
Opens a Stream from the specified path.
public override Stream OpenStream(string url, VirtualFileMode mode, VirtualFileAccess access, VirtualFileShare share = VirtualFileShare.Read, StreamFlags streamFlags = StreamFlags.None)
Parameters
urlstringmodeVirtualFileModeThe mode.
accessVirtualFileAccessThe access.
shareVirtualFileShareThe process sharing mode.
streamFlagsStreamFlagsThe type of stream needed
Returns
- Stream
The opened stream.
ResolveObjectId(string, out ObjectId)
Resolves the given VFS URL into a ObjectId and its DatabaseFileProvider.
public static DatabaseFileProvider ResolveObjectId(string url, out ObjectId objectId)
Parameters
Returns
- DatabaseFileProvider
The DatabaseFileProvider containing this object if it could be found; [null] otherwise.