C# Class Argentini.Halide.H3Storage

The H3Storage class contains methods and properties for performing or evaluating disk and file operations.
Datei anzeigen Open project: argentini/Halide

Public Methods

Method Description
CreateDirectory ( string path ) : System.Boolean

Create a directory at a given web path.

DeleteDirectory ( string directory ) : String

Deletes a directory, and any files and subdirectories it contains. Directory passed is in standard web form (e.g. "/temp").

DeleteFiles ( string fileSpec ) : Int32

Deletes a single file immediately.

DeleteFiles ( string path, string fileSpec ) : Int32

Deletes file(s) immediately.

DeleteFiles ( string path, string filter, PathOptions options, System age ) : Int32

Deletes file(s) from a directory, based on age.

DeleteFiles ( string path, string fileSpec, bool includeSpecial ) : Int32

Deletes file(s) immediately.

DirectoryExists ( string path ) : System.Boolean

Determines if a directory exists at a given web path.

FileExists ( string path ) : System.Boolean

Determines if a file exists at a given web path.

GetFileExtension ( string fileName ) : String

Retrieve a file's extension, without the period.

GetFileSize ( string path ) : System.Int64

Get the file size in bytes of a file on disk.

GetFiles ( string path, string filter ) : ArrayList

Reads filenames from a directory and returns an ArrayList.

GetFiles ( string path, string filter, PathOptions options ) : ArrayList

Reads filenames from a directory and returns an ArrayList.

GetFolders ( string path ) : String[]

Reads directory names from a gievn path and returns a string array.

MakeUniqueFilename ( string ext ) : String

Creates a unique, cryptic filename (based on GUID) for use in temporary file manipulation.

MakeValidFileName ( string fileName ) : String

Replaces any invalid characters in a file name with underscores, returning the filtered filename.

MapPath ( string path ) : string

Transforms relative path to exact path for web and console apps.

ReadFile ( string filename ) : String

Reads the contents of a text file.

WriteFile ( string filename, string content ) : String

Writes a string to a text file.

Private Methods

Method Description
H3Storage ( ) : System

Method Details

CreateDirectory() public static method

Create a directory at a given web path.
public static CreateDirectory ( string path ) : System.Boolean
path string Path and new directory (e.g. "/downloads/newdir").
return System.Boolean

DeleteDirectory() public static method

Deletes a directory, and any files and subdirectories it contains. Directory passed is in standard web form (e.g. "/temp").
public static DeleteDirectory ( string directory ) : String
directory string Directory to delete (as "/temp"). Passing an empty string will delete the current working directory!
return String

DeleteFiles() public static method

Deletes a single file immediately.
public static DeleteFiles ( string fileSpec ) : Int32
fileSpec string Web-formatted path with file name.
return System.Int32

DeleteFiles() public static method

Deletes file(s) immediately.
public static DeleteFiles ( string path, string fileSpec ) : Int32
path string Web-formatted path where the files exist.
fileSpec string String filename wildcard (*.* is assumed by default). Separate multiple filespecs with a bar character (e.g. "*.gif|*.jpg").
return System.Int32

DeleteFiles() public static method

Deletes file(s) from a directory, based on age.
public static DeleteFiles ( string path, string filter, PathOptions options, System age ) : Int32
path string Web-formatted path to the files or a full path and filename to delete a single file (the later ignores any age params).
filter string String filename wildcard (*.* is assumed by default). Separate multiple filespecs with a bar character (e.g. "*.gif|*.jpg").
options PathOptions options for file inclusion (PathOptions.Hidden | PathOptions.System) deletes all files, including hidden and system files.
age System DateTime object; files older than this (creation date; within 1 minute) are deleted.
return System.Int32

DeleteFiles() public static method

Deletes file(s) immediately.
public static DeleteFiles ( string path, string fileSpec, bool includeSpecial ) : Int32
path string Web-formatted path where the files exist.
fileSpec string String filename wildcard (*.* is assumed by default). Separate multiple filespecs with a bar character (e.g. "*.gif|*.jpg").
includeSpecial bool Set to true to deleted hidden/system files.
return System.Int32

DirectoryExists() public static method

Determines if a directory exists at a given web path.
public static DirectoryExists ( string path ) : System.Boolean
path string Path to a directory (e.g. "/downloads/").
return System.Boolean

FileExists() public static method

Determines if a file exists at a given web path.
public static FileExists ( string path ) : System.Boolean
path string Path to a file (e.g. "/downloads/file.jpg").
return System.Boolean

GetFileExtension() public static method

Retrieve a file's extension, without the period.
public static GetFileExtension ( string fileName ) : String
fileName string File name to parse.
return String

GetFileSize() public static method

Get the file size in bytes of a file on disk.
public static GetFileSize ( string path ) : System.Int64
path string Path to a file (e.g. "/downloads/file.jpg").
return System.Int64

GetFiles() public static method

Reads filenames from a directory and returns an ArrayList.
public static GetFiles ( string path, string filter ) : ArrayList
path string Web-formatted path to the files.
filter string String filename wildcard (*.* is assumed by default). /// Separate multiple filespecs with a bar character (e.g. "*.gif|*.jpg")
return System.Collections.ArrayList

GetFiles() public static method

Reads filenames from a directory and returns an ArrayList.
public static GetFiles ( string path, string filter, PathOptions options ) : ArrayList
path string Web-formatted path to the files.
filter string String filename wildcard (*.* is assumed by default). /// Separate multiple filespecs with a bar character (e.g. "*.gif|*.jpg")
options PathOptions options for returned files inclusion, et al. /// (e.g. (PathOptions.Hidden | PathOptions.System | PathOptions.Path) returns all files, /// including hidden and system files, and the filename includes the full path).
return System.Collections.ArrayList

GetFolders() public static method

Reads directory names from a gievn path and returns a string array.
public static GetFolders ( string path ) : String[]
path string Web-formatted parent path to examine.
return String[]

MakeUniqueFilename() public static method

Creates a unique, cryptic filename (based on GUID) for use in temporary file manipulation.
public static MakeUniqueFilename ( string ext ) : String
ext string File extension to append to the name, without leading period.
return String

MakeValidFileName() public static method

Replaces any invalid characters in a file name with underscores, returning the filtered filename.
public static MakeValidFileName ( string fileName ) : String
fileName string File name to filter.
return String

MapPath() public static method

Transforms relative path to exact path for web and console apps.
public static MapPath ( string path ) : string
path string Web-style path to a file (e.g. "/downloads/file.jpg").
return string

ReadFile() public static method

Reads the contents of a text file.
public static ReadFile ( string filename ) : String
filename string Web-formatted path and file name to read.
return String

WriteFile() public static method

Writes a string to a text file.
public static WriteFile ( string filename, string content ) : String
filename string Web-formatted path and file name to save.
content string String to save into file.
return String