Class FolderProvider
Base class that provides common functionality to work with files and folders.
Namespace: DotNetNuke.Services.FileSystem
Assembly: DotNetNuke.dll
Syntax
public abstract class FolderProvider : object
Properties
| Improve this Doc View SourceIsStorageSecure
Gets a value indicating whether gets a value indicating if the provider ensures the files/folders it manages are secure from outside access.
Declaration
public virtual bool IsStorageSecure { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Some providers (e.g. Standard) store their files/folders in a way that allows for anonymous access that bypasses DotNetNuke. These providers cannot guarantee that files are only accessed by authorized users and must return false.
RequiresNetworkConnectivity
Gets a value indicating whether gets a value indicating if the provider requires network connectivity to do its tasks.
Declaration
public virtual bool RequiresNetworkConnectivity { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
SupportsMappedPaths
Gets a value indicating whether indicates if the folder provider supports mapped paths when creating new folders.
Declaration
public virtual bool SupportsMappedPaths { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
If this method is not overridden it returns false.
SupportsMoveFile
Gets a value indicating whether the provider supports the MoveFile(IFileInfo, IFolderInfo) method. If a provider supports the MoveFile(IFileInfo, IFolderInfo) method, the folder manager does not have to implement move by copying the file and then deleting the original.
Declaration
public virtual bool SupportsMoveFile { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
SupportsMoveFolder
Gets a value indicating whether the provider supports the MoveFolder(String, String, FolderMappingInfo) method. If a provider supports the MoveFolder(String, String, FolderMappingInfo) method, the folder manager does not have to implement move by copying the folder and then deleting the original.
Declaration
public virtual bool SupportsMoveFolder { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceAddFile(IFolderInfo, String, Stream)
Adds a new file to the specified folder.
Declaration
public abstract void AddFile(IFolderInfo folder, string fileName, Stream content)
Parameters
Type | Name | Description |
---|---|---|
IFolderInfo | folder | |
System.String | fileName | |
Stream | content |
Remarks
Do not close content Stream.
AddFolder(String, FolderMappingInfo, String)
Base class that provides common functionality to work with files and folders.
Declaration
public virtual void AddFolder(string folderPath, FolderMappingInfo folderMapping, string mappedPath)
Parameters
Type | Name | Description |
---|---|---|
System.String | folderPath | |
FolderMappingInfo | folderMapping | |
System.String | mappedPath |
AddFolder(String, FolderMappingInfo)
Adds a new folder to a specified parent folder.
Declaration
public abstract void AddFolder(string folderPath, FolderMappingInfo folderMapping)
Parameters
Type | Name | Description |
---|---|---|
System.String | folderPath | |
FolderMappingInfo | folderMapping |
CopyFile(String, String, String, FolderMappingInfo)
Copies the specified file to the destination folder.
Declaration
public virtual void CopyFile(string folderPath, string fileName, string newFolderPath, FolderMappingInfo folderMapping)
Parameters
Type | Name | Description |
---|---|---|
System.String | folderPath | |
System.String | fileName | |
System.String | newFolderPath | |
FolderMappingInfo | folderMapping |
DeleteFile(IFileInfo)
Deletes the specified file.
Declaration
public abstract void DeleteFile(IFileInfo file)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file |
DeleteFolder(IFolderInfo)
Deletes the specified folder.
Declaration
public abstract void DeleteFolder(IFolderInfo folder)
Parameters
Type | Name | Description |
---|---|---|
IFolderInfo | folder |
EncryptValue(String)
Base class that provides common functionality to work with files and folders.
Declaration
public string EncryptValue(string settingValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | settingValue |
Returns
Type | Description |
---|---|
System.String |
FileExists(IFolderInfo, String)
Checks the existence of the specified file in the underlying system.
Declaration
public abstract bool FileExists(IFolderInfo folder, string fileName)
Parameters
Type | Name | Description |
---|---|---|
IFolderInfo | folder | |
System.String | fileName |
Returns
Type | Description |
---|---|
System.Boolean | true if the file exists, otherwise false. |
FolderExists(String, FolderMappingInfo)
Checks the existence of the specified folder in the underlying system.
Declaration
public abstract bool FolderExists(string folderPath, FolderMappingInfo folderMapping)
Parameters
Type | Name | Description |
---|---|---|
System.String | folderPath | |
FolderMappingInfo | folderMapping |
Returns
Type | Description |
---|---|
System.Boolean | true if the folder exists, otherwise false. |
GetEncryptedSetting(Hashtable, String)
Gets the decrypted value of an encrypted folder mapping setting.
Declaration
public string GetEncryptedSetting(Hashtable folderMappingSettings, string settingName)
Parameters
Type | Name | Description |
---|---|---|
Hashtable | folderMappingSettings | Folder mapping settings. |
System.String | settingName | Setting name. |
Returns
Type | Description |
---|---|
System.String | decrypted value. |
Remarks
If the value is not set the method returns null.
GetFileAttributes(IFileInfo)
Gets the file attributes of the specified file.
Declaration
public abstract FileAttributes? GetFileAttributes(IFileInfo file)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file |
Returns
Type | Description |
---|---|
System.Nullable<FileAttributes> | The file attributes or null. |
Remarks
Because some Providers don't support file attributes, this methods returns a nullable type to allow them to return null.
GetFiles(IFolderInfo)
Gets the list of file names contained in the specified folder.
Declaration
public abstract string[] GetFiles(IFolderInfo folder)
Parameters
Type | Name | Description |
---|---|---|
IFolderInfo | folder |
Returns
Type | Description |
---|---|
System.String[] | An array of file names. |
GetFileSize(IFileInfo)
Gets the file length.
Declaration
public abstract long GetFileSize(IFileInfo file)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file |
Returns
Type | Description |
---|---|
System.Int64 | The file size. |
GetFileStream(IFileInfo)
Gets a file Stream of the specified file.
Declaration
public abstract Stream GetFileStream(IFileInfo file)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file |
Returns
Type | Description |
---|---|
Stream | A |
GetFileStream(IFolderInfo, IFileInfo, Int32)
Gets a file Stream of the specified file.
Declaration
public virtual Stream GetFileStream(IFolderInfo folder, IFileInfo file, int version)
Parameters
Type | Name | Description |
---|---|---|
IFolderInfo | folder | |
IFileInfo | file | |
System.Int32 | version |
Returns
Type | Description |
---|---|
Stream | A |
GetFileStream(IFolderInfo, String)
Gets a file Stream of the specified file.
Declaration
public abstract Stream GetFileStream(IFolderInfo folder, string fileName)
Parameters
Type | Name | Description |
---|---|---|
IFolderInfo | folder | |
System.String | fileName |
Returns
Type | Description |
---|---|
Stream | A |
GetFileUrl(IFileInfo)
Gets the direct URL to the file.
Declaration
public abstract string GetFileUrl(IFileInfo file)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file |
Returns
Type | Description |
---|---|
System.String | The URL. |
GetFolderProviderIconPath()
Gets the URL of the image to display in FileManager tree.
Declaration
public abstract string GetFolderProviderIconPath()
Returns
Type | Description |
---|---|
System.String | The image URL. |
GetHashCode(IFileInfo, Stream)
Base class that provides common functionality to work with files and folders.
Declaration
public virtual string GetHashCode(IFileInfo file, Stream fileContent)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file | |
Stream | fileContent |
Returns
Type | Description |
---|---|
System.String |
GetHashCode(IFileInfo)
Base class that provides common functionality to work with files and folders.
Declaration
public virtual string GetHashCode(IFileInfo file)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file |
Returns
Type | Description |
---|---|
System.String |
GetLastModificationTime(IFileInfo)
Gets the time when the specified file was last modified.
Declaration
public abstract DateTime GetLastModificationTime(IFileInfo file)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file |
Returns
Type | Description |
---|---|
DateTime | The last modified |
GetProviderList()
Get the list of all the folder providers.
Declaration
public static Dictionary<string, FolderProvider> GetProviderList()
Returns
Type | Description |
---|---|
Dictionary<System.String, FolderProvider> | A |
GetSettingsControlVirtualPath()
Gets the virtual path of the control file used to display and update specific folder mapping settings. By default, the control name is Settings.ascx
.
Declaration
public virtual string GetSettingsControlVirtualPath()
Returns
Type | Description |
---|---|
System.String | If the folder provider has special settings, this method returns the virtual path of the control that allows to display and set those settings. |
Remarks
The returned control must inherit from FolderMappingSettingsControlBase.
GetSubFolders(String, FolderMappingInfo)
Gets the list of subfolders for the specified folder.
Declaration
public abstract IEnumerable<string> GetSubFolders(string folderPath, FolderMappingInfo folderMapping)
Parameters
Type | Name | Description |
---|---|---|
System.String | folderPath | |
FolderMappingInfo | folderMapping |
Returns
Type | Description |
---|---|
IEnumerable<System.String> | A sequence of relative sub-folder paths. |
Instance(String)
Gets an instance of a specific FolderProvider of a given name.
Declaration
public static FolderProvider Instance(string friendlyName)
Parameters
Type | Name | Description |
---|---|---|
System.String | friendlyName |
Returns
Type | Description |
---|---|
FolderProvider | A FolderProvider instance. |
IsInSync(IFileInfo)
Indicates if the specified file is synchronized.
Declaration
public abstract bool IsInSync(IFileInfo file)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file |
Returns
Type | Description |
---|---|
System.Boolean | true if the file is in sync, otherwise false. |
MoveFile(IFileInfo, IFolderInfo)
Moves a file to a new folder.
Declaration
public virtual void MoveFile(IFileInfo file, IFolderInfo destinationFolder)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file | |
IFolderInfo | destinationFolder |
MoveFolder(String, String, FolderMappingInfo)
Moves the folder and files at the specified folder path to the new folder path.
Declaration
public virtual void MoveFolder(string folderPath, string newFolderPath, FolderMappingInfo folderMapping)
Parameters
Type | Name | Description |
---|---|---|
System.String | folderPath | |
System.String | newFolderPath | |
FolderMappingInfo | folderMapping |
RenameFile(IFileInfo, String)
Renames the specified file using the new filename.
Declaration
public abstract void RenameFile(IFileInfo file, string newFileName)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file | |
System.String | newFileName |
RenameFolder(IFolderInfo, String)
Renames the specified folder using the new newFolderName
.
Declaration
public abstract void RenameFolder(IFolderInfo folder, string newFolderName)
Parameters
Type | Name | Description |
---|---|---|
IFolderInfo | folder | |
System.String | newFolderName |
SetFileAttributes(IFileInfo, FileAttributes)
Sets the specified attributes to the specified file.
Declaration
public abstract void SetFileAttributes(IFileInfo file, FileAttributes fileAttributes)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file | |
FileAttributes | fileAttributes |
SupportsFileAttributes()
Gets a value indicating if the underlying system supports file attributes.
Declaration
public abstract bool SupportsFileAttributes()
Returns
Type | Description |
---|---|
System.Boolean | true if the provider supports file attributes, otherwise false. |
UpdateFile(IFileInfo, Stream)
Updates the content of the specified file. It creates it if it doesn't exist.
Declaration
public abstract void UpdateFile(IFileInfo file, Stream content)
Parameters
Type | Name | Description |
---|---|---|
IFileInfo | file | |
Stream | content |
Remarks
Do not close content Stream.
UpdateFile(IFolderInfo, String, Stream)
Updates the content of the specified file. It creates it if it doesn't exist.
Declaration
public abstract void UpdateFile(IFolderInfo folder, string fileName, Stream content)
Parameters
Type | Name | Description |
---|---|---|
IFolderInfo | folder | |
System.String | fileName | |
Stream | content |
Remarks
Do not close content Stream.