C# Class fCraft.Paths

Contains fCraft path settings, and some filesystem-related utilities.
Show file Open project: GlennMR/800craft Class Usage Examples

Public Properties

Property Type Description
WorkingPathDefault string

Public Methods

Method Description
Compare ( [ p1, [ p2 ) : bool

Returns true if paths or filenames reference the same location (accounts for all the filesystem quirks).

Compare ( [ p1, [ p2, bool caseSensitive ) : bool

Returns true if paths or filenames reference the same location (accounts for all the filesystem quirks).

Contains ( [ parentPath, [ childPath ) : bool

Checks whether childPath is inside parentPath

Contains ( [ parentPath, [ childPath, bool caseSensitive ) : bool

Checks whether childPath is inside parentPath

Exists ( [ fileInfo, bool caseSensitive ) : bool

Checks whether the file exists in a specified way (case-sensitive or case-insensitive)

FileExists ( [ fileName, bool caseSensitive ) : bool

Checks whether the file exists in a specified way (case-sensitive or case-insensitive)

FindFiles ( [ fullFileName ) : System.IO.FileInfo[]

Find files that match the name in a case-insensitive way.

ForceRename ( [ originalFullFileName, [ newFileName ) : void

Allows making changes to filename capitalization on case-insensitive filesystems.

IsDefaultMapPath ( [ path ) : bool
IsProtectedFileName ( [ fileName ) : bool
IsValidPath ( string path ) : bool
MoveOrReplace ( [ source, [ destination ) : void
TestDirectory ( [ pathLabel, [ path, bool checkForWriteAccess ) : bool

Makes sure that the path format is valid, that it exists, that it is accessible and writeable.

TestFile ( [ fileLabel, [ filename, bool createIfDoesNotExist, FileAccess neededAccess ) : bool

Makes sure that the path format is valid, and optionally whether it is readable/writeable.

Private Methods

Method Description
Paths ( ) : System

Method Details

Compare() public static method

Returns true if paths or filenames reference the same location (accounts for all the filesystem quirks).
public static Compare ( [ p1, [ p2 ) : bool
p1 [
p2 [
return bool

Compare() public static method

Returns true if paths or filenames reference the same location (accounts for all the filesystem quirks).
public static Compare ( [ p1, [ p2, bool caseSensitive ) : bool
p1 [
p2 [
caseSensitive bool
return bool

Contains() public static method

Checks whether childPath is inside parentPath
public static Contains ( [ parentPath, [ childPath ) : bool
parentPath [ Path that is supposed to contain childPath
childPath [ Path that is supposed to be contained within parentPath
return bool

Contains() public static method

Checks whether childPath is inside parentPath
public static Contains ( [ parentPath, [ childPath, bool caseSensitive ) : bool
parentPath [ Path that is supposed to contain childPath
childPath [ Path that is supposed to be contained within parentPath
caseSensitive bool Whether check should be case-sensitive or case-insensitive.
return bool

Exists() public static method

Checks whether the file exists in a specified way (case-sensitive or case-insensitive)
public static Exists ( [ fileInfo, bool caseSensitive ) : bool
fileInfo [ FileInfo object in question
caseSensitive bool Whether check should be case-sensitive or case-insensitive.
return bool

FileExists() public static method

Checks whether the file exists in a specified way (case-sensitive or case-insensitive)
public static FileExists ( [ fileName, bool caseSensitive ) : bool
fileName [ filename in question
caseSensitive bool Whether check should be case-sensitive or case-insensitive.
return bool

FindFiles() public static method

Find files that match the name in a case-insensitive way.
public static FindFiles ( [ fullFileName ) : System.IO.FileInfo[]
fullFileName [ Case-insensitive filename to look for.
return System.IO.FileInfo[]

ForceRename() public static method

Allows making changes to filename capitalization on case-insensitive filesystems.
public static ForceRename ( [ originalFullFileName, [ newFileName ) : void
originalFullFileName [ Full path to the original filename
newFileName [ New file name (do not include the full path)
return void

IsDefaultMapPath() public static method

public static IsDefaultMapPath ( [ path ) : bool
path [
return bool

IsProtectedFileName() public static method

public static IsProtectedFileName ( [ fileName ) : bool
fileName [
return bool

IsValidPath() public static method

public static IsValidPath ( string path ) : bool
path string
return bool

MoveOrReplace() public static method

public static MoveOrReplace ( [ source, [ destination ) : void
source [
destination [
return void

TestDirectory() public static method

Makes sure that the path format is valid, that it exists, that it is accessible and writeable.
public static TestDirectory ( [ pathLabel, [ path, bool checkForWriteAccess ) : bool
pathLabel [ Name of the path that's being tested (e.g. "map path"). Used for logging.
path [ Full or partial path.
checkForWriteAccess bool If set, tries to write to the given directory.
return bool

TestFile() public static method

Makes sure that the path format is valid, and optionally whether it is readable/writeable.
public static TestFile ( [ fileLabel, [ filename, bool createIfDoesNotExist, FileAccess neededAccess ) : bool
fileLabel [ Name of the path that's being tested (e.g. "map path"). Used for logging.
filename [ Full or partial path of the file.
createIfDoesNotExist bool If target file is missing and this option is OFF, TestFile returns true. /// If target file is missing and this option is ON, TestFile tries to create /// a file and returns whether it succeeded.
neededAccess FileAccess If file is present, type of access to test.
return bool

Property Details

WorkingPathDefault public static property

public static string WorkingPathDefault
return string