C# Class ScrewTurn.Wiki.FilesStorageProvider

Implements a Local Files Storage Provider.
Inheritance: IFilesStorageProviderV30
显示文件 Open project: mono/ScrewTurnWiki Class Usage Examples

Public Methods

Method Description
CreateDirectory ( string path, string name ) : bool

Creates a new Directory.

If path is "/my/directory" and name is "newdir", a new directory named "/my/directory/newdir" is created.

DeleteDirectory ( string fullPath ) : bool

Deletes a Directory and all of its content.

DeleteFile ( string fullName ) : bool

Deletes a File.

DeletePageAttachment ( System.PageInfo pageInfo, string name ) : bool

Deletes a Page Attachment.

GetFileDetails ( string fullName ) : FileDetails

Gets the details of a file.

GetPageAttachmentDetails ( System.PageInfo pageInfo, string name ) : FileDetails

Gets the details of a page attachment.

GetPagesWithAttachments ( ) : string[]

The the names of the pages with attachments.

Init ( IHostV30 host, string config ) : void

Initializes the Storage Provider.

ListDirectories ( string directory ) : string[]

Lists the Directories in the specified directory.

ListFiles ( string directory ) : string[]

Lists the Files in the specified Directory.

ListPageAttachments ( System.PageInfo pageInfo ) : string[]

Returns the names of the Attachments of a Page.

NotifyPageRenaming ( System.PageInfo oldPage, System.PageInfo newPage ) : void

Notifies to the Provider that a Page has been renamed.

RenameDirectory ( string oldFullPath, string newFullPath ) : bool

Renames or moves a Directory.

RenameFile ( string oldFullName, string newFullName ) : bool

Renames or moves a File.

RenamePageAttachment ( System.PageInfo pageInfo, string oldName, string newName ) : bool

Renames a Page Attachment.

RetrieveFile ( string fullName, Stream destinationStream, bool countHit ) : bool

Retrieves a File.

RetrievePageAttachment ( System.PageInfo pageInfo, string name, Stream destinationStream, bool countHit ) : bool

Retrieves a Page Attachment.

SetFileRetrievalCount ( string fullName, int count ) : void

Clears the number of times a file was retrieved.

SetPageAttachmentRetrievalCount ( System.PageInfo pageInfo, string name, int count ) : void

Set the number of times a page attachment was retrieved.

Shutdown ( ) : void

Method invoked on shutdown.

This method might not be invoked in some cases.

StoreFile ( string fullName, Stream sourceStream, bool overwrite ) : bool

Stores a file.

If overwrite is false and File already exists, the method returns false.

StorePageAttachment ( System.PageInfo pageInfo, string name, Stream sourceStream, bool overwrite ) : bool

Stores a Page Attachment.

If overwrite is false and Attachment already exists, the method returns false.

Private Methods

Method Description
AddDownloadHit ( string itemName, string outputFile ) : void

Adds a download hit for the specified item in the specified output file.

BuildFullPath ( string partialPath ) : string

Builds a full path from a provider-specific partial path.

For example: if partialPath is "/my/directory", the method returns "C:\Inetpub\wwwroot\Wiki\public\Upload\my\directory", assuming the Wiki resides in "C:\Inetpub\wwwroot\Wiki".

BuildFullPathForAttachments ( string partialPath ) : string

Builds a full path from a provider-specific partial path.

For example: if partialPath is "/my/directory", the method returns "C:\Inetpub\wwwroot\Wiki\public\Attachments\my\directory", assuming the Wiki resides in "C:\Inetpub\wwwroot\Wiki".

CheckPath ( string path, string begin ) : string

Checks the path.

ClearDownloadHitsPartialMatch ( string itemName, string outputFile ) : void

Clears the download hits for the items that match itemName in the specified file.

GetFileRetrievalCount ( string fullName ) : int

Gets the number of times a file was retrieved.

GetFullPath ( string finalChunk ) : string
GetPageAttachmentDirectory ( System.PageInfo pageInfo ) : string

Gets the name of the Directory containing the Attachments of a Page.

GetPageAttachmentRetrievalCount ( System.PageInfo pageInfo, string name ) : int

Gets the number of times a page attachment was retrieved.

RenameDownloadHitsItem ( string oldItemName, string newItemName, string outputFile ) : void

Renames an item of the download count list in the specified file.

RenameDownloadHitsItemPartialMatch ( string oldItemName, string newItemName, string outputFile ) : void

Renames an item of the download count list in the specified file.

SetDownloadHits ( string itemName, string outputFile, int count ) : void

Sets the download hits for the specified item in the specified file.

StreamCopy ( Stream source, Stream destination ) : void

Copies data from a Stream to another.

Method Details

CreateDirectory() public method

Creates a new Directory.
If path is "/my/directory" and name is "newdir", a new directory named "/my/directory/newdir" is created.
If or are null. If is empty or if the directory does not exist, or if the new directory already exists.
public CreateDirectory ( string path, string name ) : bool
path string The path to create the new Directory in.
name string The name of the new Directory.
return bool

DeleteDirectory() public method

Deletes a Directory and all of its content.
If is null. If is empty or if it equals '/' or it does not exist.
public DeleteDirectory ( string fullPath ) : bool
fullPath string The full path of the Directory.
return bool

DeleteFile() public method

Deletes a File.
If is null. If is empty or it does not exist.
public DeleteFile ( string fullName ) : bool
fullName string The full name of the File.
return bool

DeletePageAttachment() public method

Deletes a Page Attachment.
If or are null. If is empty or if the page or attachment do not exist.
public DeletePageAttachment ( System.PageInfo pageInfo, string name ) : bool
pageInfo System.PageInfo The Page Info that owns the Attachment.
name string The name of the Attachment, for example "myfile.jpg".
return bool

GetFileDetails() public method

Gets the details of a file.
If is null. If is empty.
public GetFileDetails ( string fullName ) : FileDetails
fullName string The full name of the file.
return ScrewTurn.Wiki.PluginFramework.FileDetails

GetPageAttachmentDetails() public method

Gets the details of a page attachment.
If or are null. If is empty.
public GetPageAttachmentDetails ( System.PageInfo pageInfo, string name ) : FileDetails
pageInfo System.PageInfo The page that owns the attachment.
name string The name of the attachment, for example "myfile.jpg".
return ScrewTurn.Wiki.PluginFramework.FileDetails

GetPagesWithAttachments() public method

The the names of the pages with attachments.
public GetPagesWithAttachments ( ) : string[]
return string[]

Init() public method

Initializes the Storage Provider.
If or are null. If is not valid or is incorrect.
public Init ( IHostV30 host, string config ) : void
host IHostV30 The Host of the Component.
config string The Configuration data, if any.
return void

ListDirectories() public method

Lists the Directories in the specified directory.
If does not exist.
public ListDirectories ( string directory ) : string[]
directory string The full directory name, for example "/my/directory". Null, empty or "/" for the root directory.
return string[]

ListFiles() public method

Lists the Files in the specified Directory.
If does not exist.
public ListFiles ( string directory ) : string[]
directory string The full directory name, for example "/my/directory". Null, empty or "/" for the root directory.
return string[]

ListPageAttachments() public method

Returns the names of the Attachments of a Page.
If is null.
public ListPageAttachments ( System.PageInfo pageInfo ) : string[]
pageInfo System.PageInfo The Page Info object that owns the Attachments.
return string[]

NotifyPageRenaming() public method

Notifies to the Provider that a Page has been renamed.
If or are null If the new page is already in use.
public NotifyPageRenaming ( System.PageInfo oldPage, System.PageInfo newPage ) : void
oldPage System.PageInfo The old Page Info object.
newPage System.PageInfo The new Page Info object.
return void

RenameDirectory() public method

Renames or moves a Directory.
If or are null. If or are empty or equal to '/', /// or if the old directory does not exist or the new directory already exists.
public RenameDirectory ( string oldFullPath, string newFullPath ) : bool
oldFullPath string The old full path of the Directory.
newFullPath string The new full path of the Directory.
return bool

RenameFile() public method

Renames or moves a File.
If or are null. If or are empty, or if the old file does not exist, or if the new file already exist.
public RenameFile ( string oldFullName, string newFullName ) : bool
oldFullName string The old full name of the File.
newFullName string The new full name of the File.
return bool

RenamePageAttachment() public method

Renames a Page Attachment.
If , or are null. If , or are empty, /// or if the page or old attachment do not exist, or the new attachment name already exists.
public RenamePageAttachment ( System.PageInfo pageInfo, string oldName, string newName ) : bool
pageInfo System.PageInfo The Page Info that owns the Attachment.
oldName string The old name of the Attachment.
newName string The new name of the Attachment.
return bool

RetrieveFile() public method

Retrieves a File.
If os are null. If is empty or does not support writing, or if does not exist.
public RetrieveFile ( string fullName, Stream destinationStream, bool countHit ) : bool
fullName string The full name of the File.
destinationStream Stream A Stream object used as destination of a byte stream, /// i.e. the method writes to the Stream the file content.
countHit bool A value indicating whether or not to count this retrieval in the statistics.
return bool

RetrievePageAttachment() public method

Retrieves a Page Attachment.
If , or are null. If is empty or if does not support writing, /// or if the page does not have attachments or if the attachment does not exist.
public RetrievePageAttachment ( System.PageInfo pageInfo, string name, Stream destinationStream, bool countHit ) : bool
pageInfo System.PageInfo The Page Info that owns the Attachment.
name string The name of the Attachment, for example "myfile.jpg".
destinationStream Stream A Stream object used as destination of a byte stream, /// i.e. the method writes to the Stream the file content.
countHit bool A value indicating whether or not to count this retrieval in the statistics.
return bool

SetFileRetrievalCount() public method

Clears the number of times a file was retrieved.
If is null. If is empty. If is less than zero.
public SetFileRetrievalCount ( string fullName, int count ) : void
fullName string The full name of the file.
count int The count to set.
return void

SetPageAttachmentRetrievalCount() public method

Set the number of times a page attachment was retrieved.
If or are null. If is empty. If is less than zero.
public SetPageAttachmentRetrievalCount ( System.PageInfo pageInfo, string name, int count ) : void
pageInfo System.PageInfo The page.
name string The name of the attachment.
count int The count to set.
return void

Shutdown() public method

Method invoked on shutdown.
This method might not be invoked in some cases.
public Shutdown ( ) : void
return void

StoreFile() public method

Stores a file.
If overwrite is false and File already exists, the method returns false.
If os are null. If is empty or does not support reading.
public StoreFile ( string fullName, Stream sourceStream, bool overwrite ) : bool
fullName string The full name of the file.
sourceStream Stream A Stream object used as source of a byte stream, /// i.e. the method reads from the Stream and stores the content properly.
overwrite bool true to overwrite an existing file.
return bool

StorePageAttachment() public method

Stores a Page Attachment.
If overwrite is false and Attachment already exists, the method returns false.
If , or are null. If is empty or if does not support reading.
public StorePageAttachment ( System.PageInfo pageInfo, string name, Stream sourceStream, bool overwrite ) : bool
pageInfo System.PageInfo The Page Info that owns the Attachment.
name string The name of the Attachment, for example "myfile.jpg".
sourceStream Stream A Stream object used as source of a byte stream, /// i.e. the method reads from the Stream and stores the content properly.
overwrite bool true to overwrite an existing Attachment.
return bool