Table of Contents

Class CPFileSystemBaseClass

Namespace
Contensive.BaseClasses
Assembly
CPBase.dll
public abstract class CPFileSystemBaseClass
Inheritance
CPFileSystemBaseClass
Inherited Members

Properties

PhysicalFilePath

The physical file path of the local storage for this resource

public abstract string PhysicalFilePath { get; }

Property Value

string

Methods

Append(string, string)

Append content to end of a text file

public abstract void Append(string filename, string fileContent)

Parameters

filename string
fileContent string

Copy(string, string)

Copy a file within the same filesystem (TempFiles, cndFiles, wwwFiles, privateFiles)

public abstract void Copy(string sourcePathFilename, string destinationPathFilename)

Parameters

sourcePathFilename string
destinationPathFilename string

Copy(string, string, CPFileSystemBaseClass)

Copy a file to a different filesystem (TempFiles, cndFiles, wwwFiles, privateFiles)

public abstract void Copy(string sourcePathFilename, string destinationPathFilename, CPFileSystemBaseClass destinationFileSystem)

Parameters

sourcePathFilename string
destinationPathFilename string
destinationFileSystem CPFileSystemBaseClass

CopyLocalToRemote(string)

Copy a file from the local storage to its remote store

public abstract void CopyLocalToRemote(string pathFilename)

Parameters

pathFilename string

CopyPath(string, string)

Recursively copy all files in a path to a path the same filesystem (TempFiles, cndFiles, wwwFiles, privateFiles). A path is either blank or begins with a folder name and ends with ''. Valid sample paths are '', 'MyFolder\SubFolder'

public abstract void CopyPath(string sourcePath, string destinationPath)

Parameters

sourcePath string
destinationPath string

CopyPath(string, string, CPFileSystemBaseClass)

Recursively copy all files in a path to a path in a different filesystem (TempFiles, cndFiles, wwwFiles, privateFiles). A path is either blank or begins with a folder name and ends with ''. Valid sample paths are '', 'MyFolder\SubFolder'

public abstract void CopyPath(string sourcePath, string destinationPath, CPFileSystemBaseClass destinationFileSystem)

Parameters

sourcePath string
destinationPath string
destinationFileSystem CPFileSystemBaseClass

CopyRemoteToLocal(string)

Copy a file from the remote storate to its local store.

public abstract void CopyRemoteToLocal(string pathFilename)

Parameters

pathFilename string

The path followed by the filename. Path arguments have no leading slash, but they include a trailing slash. ex ParentFolder/SubFolder/Filename.ext

CreateFolder(string)

Create a folder in a path.

public abstract void CreateFolder(string pathFolder)

Parameters

pathFolder string

A path followed by a folder name. (ex ParentFolder/SubFolder/NewFolderName ) Path arguments should have no leading slash.

CreateUniqueFolder()

Create a folder with a unique name. Return the path to the new folder. (Path values have no leading slash, and have a trailing slash, ex NewPath/ )

public abstract string CreateUniqueFolder()

Returns

string

DeleteFile(string)

Delete a file in a path. Path arguments should have no leading slash. (ex ParentFolder/FileToDelete.txt )

public abstract void DeleteFile(string pathFilename)

Parameters

pathFilename string

DeleteFolder(string)

Delete a folder and all files and subfolders. Path arguments should have no leading slash. (ex ParentFolder/FolderToDelete )

public abstract void DeleteFolder(string folderPath)

Parameters

folderPath string

EncodePathFilename(string)

Change a pathFilename by converting invalid characters to "_". Returns Unix path, but all methods use both Unix and Dos slash. Simple pathFilenames for compatibility with DOS paths and files, Unix and AWS S3 buckets and keys. See isValidPathFilename for description of invalid characters

public abstract string EncodePathFilename(string pathFilename)

Parameters

pathFilename string

See IsValidPathFilename for details.

Returns

string

FileDetails(string)

Get the details of a file. Returns null if the file is not found. Path arguments should have no leading slash. (ex ParentFolder/FileName.ext )

public abstract CPFileSystemBaseClass.FileDetail FileDetails(string PathFilename)

Parameters

PathFilename string

Returns

CPFileSystemBaseClass.FileDetail

FileExists(string)

Returns true if a file exists in this path

public abstract bool FileExists(string pathFilename)

Parameters

pathFilename string

Returns

bool

FileList(string)

public abstract List<CPFileSystemBaseClass.FileDetail> FileList(string folderPath)

Parameters

folderPath string

Returns

List<CPFileSystemBaseClass.FileDetail>

FileList(string, int)

public abstract List<CPFileSystemBaseClass.FileDetail> FileList(string folderPath, int pageSize)

Parameters

folderPath string
pageSize int

Returns

List<CPFileSystemBaseClass.FileDetail>

FileList(string, int, int)

Get the details of all files in a folder. Path arguments should have no leading slash. (ex ParentFolder/FolderName )

public abstract List<CPFileSystemBaseClass.FileDetail> FileList(string folderPath, int pageSize, int pageNumber)

Parameters

folderPath string
pageSize int
pageNumber int

Returns

List<CPFileSystemBaseClass.FileDetail>

FolderExists(string)

Returns true if a folder exists in this path

public abstract bool FolderExists(string folderName)

Parameters

folderName string

Returns

bool

FolderList(string)

Get the details of all folders in a path. Path arguments should have no leading slash. (ex ParentFolder )

public abstract List<CPFileSystemBaseClass.FolderDetail> FolderList(string folderPath)

Parameters

folderPath string

Returns

List<CPFileSystemBaseClass.FolderDetail>

GetFilename(string)

Returns the path of a pathFilename argument. For example "folder1/folder2/file.txt" returns "file.txt"

public abstract string GetFilename(string pathFilename)

Parameters

pathFilename string

Returns

string

GetPath(string)

Returns the path of a pathFilename argument. For example "folder1/folder2/file.txt" returns "folder1/folder2/"

public abstract string GetPath(string pathFilename)

Parameters

pathFilename string

Returns

string

IsValidPathFilename(string)

Returns true if filename is valid. Paths separated by / or . Simple pathFilenames for compatibility with DOS paths and files, Unix and AWS S3 buckets and keys. Allows 0-9, a-z, A-Z, and "-._"

public abstract bool IsValidPathFilename(string pathFilename)

Parameters

pathFilename string

pathFilename is the path and filename that are used for all methods, and are relative to the filesystems (cdn,private,temp,www) Path arguments start with a slash, ends with no slash Paths are created with UNIX slash, but accept both slash, / or \

Returns

bool

Read(string)

Read a text file. Path arguments should have no leading slash. (ex ParentFolder/FileToRead.txt )

public abstract string Read(string pathFilename)

Parameters

pathFilename string

Returns

string

ReadBinary(string)

Read a file to a byte array. Path arguments should have no leading slash. (ex ParentFolder/FileToRead.bin )

public abstract byte[] ReadBinary(string pathFilename)

Parameters

pathFilename string

Returns

byte[]

Save(string, string)

Save content to a text file. Path arguments should have no leading slash. (ex ParentFolder/FileToSave.txt )

public abstract void Save(string pathFilename, string fileContent)

Parameters

pathFilename string
fileContent string

SaveBinary(string, byte[])

Save a byte array to a file. Path arguments should have no leading slash. (ex ParentFolder/FileToSave.bin )

public abstract void SaveBinary(string pathFilename, byte[] fileContent)

Parameters

pathFilename string
fileContent byte[]

SaveHttpGet(string, string)

Get url to a text file

public abstract void SaveHttpGet(string url, string pathFilename)

Parameters

url string
pathFilename string

SaveHttpPost(string, string, List<KeyValuePair<string, string>>)

Post key/values to a url and save to text file

public abstract void SaveHttpPost(string url, string pathFilename, List<KeyValuePair<string, string>> requestArguments)

Parameters

url string
pathFilename string
requestArguments List<KeyValuePair<string, string>>

SaveHttpPost(string, string, string)

post entity to a url and save to text file

public abstract void SaveHttpPost(string url, string pathFilename, string entity)

Parameters

url string
pathFilename string
entity string

SaveUpload(string, string, ref string)

Handle a file upload to a path from a submitted post. If successful, return true and the filename.

public abstract bool SaveUpload(string htmlFormName, string folderPath, ref string returnFilename)

Parameters

htmlFormName string
folderPath string
returnFilename string

Returns

bool

SaveUpload(string, ref string)

Handle a file upload from a submitted post to the /upload path. If successful, return true and the filename.

public abstract bool SaveUpload(string htmlformName, ref string returnFilename)

Parameters

htmlformName string
returnFilename string

Returns

bool

UnzipFile(string)

unzip a zip file to a folder with the same name

public abstract void UnzipFile(string pathFilename)

Parameters

pathFilename string

ZipPath(string, string)

Create a zip file and add all the files in a path recursively

public abstract void ZipPath(string archivePathFilename, string path)

Parameters

archivePathFilename string
path string