Pathfinder  v3.0
The definitive Hacknet programmable modding system
Pathfinder.GameFilesystem.Directory Class Reference
+ Inheritance diagram for Pathfinder.GameFilesystem.Directory:

Public Member Functions

 Directory (Folder obj, IFileObject parent)
 
File FindFile (string name)
 Finds a File within the Directory based on its name. More...
 
Directory FindDirectory (string name)
 Finds a Directory within the Directory based on its name. More...
 
Directory SearchForDirectory (string path, bool ignoreRootSymbol, bool nullOut=false)
 Searchs for a Directory's path as far as possible. More...
 
Directory SearchForDirectory (string path)
 Searchs for a Directory's path as far as possible. More...
 
File SearchForFile (string path, bool ignoreRootSymbol)
 Searchs for a File's path as far as possible. More...
 
File SearchForFile (string path)
 Searchs for a File's path as far as possible. More...
 
File GetFile (int index)
 Gets a File based on its Index. More...
 
Directory GetDirectory (int index)
 Gets a Directory based on its Index. More...
 
File CreateFile (string name, string data=null)
 Creates a new File based on the name and data. More...
 
File CreateFile (string name, Executable.IInterface exeInterface)
 Creates a File based on the name and the Executable.IInterface generated file data. More...
 
File CreateExecutableFile (string name, string exeId)
 Creates an executable File based on the name and the file data string id. More...
 
File CreateExecutableFile (string name, int vanillaIndex)
 Creates a vanilla executable File based on the name and the vanilla data index. More...
 
File CreateRandomFile (string name=null, string data=null)
 Creates a random File based either on the name or data. (if neither are null then same as CreateFile) More...
 
File CreateRandomFile (uint nameIndex, uint? dataIndex=null)
 Creates a random File based on the nameIndex and dataIndex. More...
 
Directory CreateDirectory (string name)
 Creates a new Directory based on the name. More...
 
bool RemoveFile (string name)
 Removes a File in the Directory by its name. More...
 
bool RemoveFile (File f)
 Removes a File in the Directory. More...
 
bool RemoveDirectory (string name)
 Removes a Directory in the Directory by its name. More...
 
bool RemoveDirectory (Directory d)
 Removes a Directory in the Directory. More...
 
File MoveFile (File f, Directory newDir)
 Moves a File to a new Directory. More...
 
Directory MoveDirectory (Directory d, Directory newDir)
 Moves a Directory to a new Directory. More...
 
Directory MoveTo (Directory to)
 Moves the Directory to a new Directory. More...
 
bool Contains (File f)
 Determines whether the specified File is contained within the Directory. More...
 
bool Contains (Directory d)
 Determines whether the specified Directory is contained within the Directory. More...
 
bool ContainsFile (string name=null, string data=null)
 Determines whether a File with the specified name and/or data is contained within the Directory More...
 
bool ContainsDirectory (string name, int? folderCount, int? fileCount=null)
 
bool ContainsDirectory (string name)
 
IEnumerator< IFileObjectGetEnumerator ()
 

Public Attributes

sealed override Filesystem Root => Parent.Root
 Gets the root Filesystem the Directory is within. More...
 
sealed override FileType Type => FileType.Directory
 Returns FileType.Directory More...
 
Directory ParentDirectory => (Directory)Parent
 Casts the Parent FileObject to a Directory More...
 
IFileObject this[string name] => (IFileObject)FindFile(name) ?? FindDirectory(name)
 Gets the first T:Pathfinder.GameFilesystem.IFileObject that contains the specified name, searching through files first. More...
 
List< FileFiles => Object.files.Select(f => new File(f, this)).ToList()
 Retrieves a list of Files contained within the Directory. More...
 
List< DirectoryDirectories => Object.folders.Select(f => new Directory(f, this)).ToList()
 Retrieves a list of Directories contained within the Directory. More...
 
int FileCount => Object.files.Count
 Retrieves the amount of Files within the Directory. More...
 
int DirectoryCount => Object.folders.Count
 Retrieves the amount of Directories within the Directory. More...
 

Properties

sealed override string Name [get, set]
 Gets or sets the directory name. More...
 
override string Path [get, set]
 Gets or sets the directory's path, both renames and modifies the directory's location. More...
 
sealed override int Index [get, set]
 Gets the index inside its parent's respective list More...
 

Constructor & Destructor Documentation

◆ Directory()

Pathfinder.GameFilesystem.Directory.Directory ( Folder  obj,
IFileObject  parent 
)

Member Function Documentation

◆ Contains() [1/2]

bool Pathfinder.GameFilesystem.Directory.Contains ( File  f)
Returns
true, if the File isn't null and contained within the Directory, false otherwise.
Parameters
fThe File to determine is contained within.

◆ Contains() [2/2]

bool Pathfinder.GameFilesystem.Directory.Contains ( Directory  d)
Returns
true, if the Directory isn't null and contained within the Directory, false otherwise.
Parameters
dThe Directory to determine is contained within.

◆ ContainsDirectory() [1/2]

bool Pathfinder.GameFilesystem.Directory.ContainsDirectory ( string  name,
int?  folderCount,
int?  fileCount = null 
)
Returns
true, if Directory is contained in the Directory, false otherwise.
Parameters
nameThe name to search for or null.
folderCountThe amount of folders to look for or null.
fileCountThe amount of files to look for or null.

◆ ContainsDirectory() [2/2]

bool Pathfinder.GameFilesystem.Directory.ContainsDirectory ( string  name)

◆ ContainsFile()

bool Pathfinder.GameFilesystem.Directory.ContainsFile ( string  name = null,
string  data = null 
)
Returns
true, if File is contained in the Directory, false otherwise.
Parameters
nameThe name to search for or null.
dataThe data to search for or null.

◆ CreateDirectory()

Directory Pathfinder.GameFilesystem.Directory.CreateDirectory ( string  name)
Returns
The Directory that was created.
Parameters
nameThe name to assign to the Directory.

◆ CreateExecutableFile() [1/2]

File Pathfinder.GameFilesystem.Directory.CreateExecutableFile ( string  name,
string  exeId 
)
Returns
The executable File that was created.
Parameters
nameThe name to assign to the File.
exeIdThe file data string id.

◆ CreateExecutableFile() [2/2]

File Pathfinder.GameFilesystem.Directory.CreateExecutableFile ( string  name,
int  vanillaIndex 
)
Returns
The executable File that was created.
Parameters
nameThe name to assign to the File.
vanillaIndexThe vanilla data index.

◆ CreateFile() [1/2]

File Pathfinder.GameFilesystem.Directory.CreateFile ( string  name,
string  data = null 
)
Returns
The File that was created.
Parameters
nameThe name to assign to the File.
dataThe data to assign to the File.

◆ CreateFile() [2/2]

File Pathfinder.GameFilesystem.Directory.CreateFile ( string  name,
Executable.IInterface  exeInterface 
)
Returns
The File that was created.
Parameters
nameThe name to assign to the File.
exeInterfaceThe Executable.IInterface whose file data is to be generated.

◆ CreateRandomFile() [1/2]

File Pathfinder.GameFilesystem.Directory.CreateRandomFile ( string  name = null,
string  data = null 
)
Returns
The random File that was created.
Parameters
nameThe name to assign to the File or null to apply a random name.
dataThe data to assign to the File or null to apply random data.

◆ CreateRandomFile() [2/2]

File Pathfinder.GameFilesystem.Directory.CreateRandomFile ( uint  nameIndex,
uint?  dataIndex = null 
)
Returns
The random File that was created.
Parameters
nameIndexThe FileEntry filenames index. (which will max out at the largest index)
dataIndexThe FileEntry fileData index, or nameIndex if null. (which will max out at the largest index)

◆ FindDirectory()

Directory Pathfinder.GameFilesystem.Directory.FindDirectory ( string  name)
Returns
The Directory or null if not found.
Parameters
nameThe name to find.

◆ FindFile()

File Pathfinder.GameFilesystem.Directory.FindFile ( string  name)
Returns
The File or null if not found.
Parameters
nameThe name to find.

◆ GetDirectory()

Directory Pathfinder.GameFilesystem.Directory.GetDirectory ( int  index)

This method is the most bare and unsafe method of Directory retrieval

Returns
The Directory who contains said Index.
Parameters
indexThe Index to find.

◆ GetEnumerator()

IEnumerator<IFileObject> Pathfinder.GameFilesystem.Directory.GetEnumerator ( )

◆ GetFile()

File Pathfinder.GameFilesystem.Directory.GetFile ( int  index)

This method is the most bare and unsafe method of File retrieval

Returns
The File who contains said Index.
Parameters
indexThe Index to find.

◆ MoveDirectory()

Directory Pathfinder.GameFilesystem.Directory.MoveDirectory ( Directory  d,
Directory  newDir 
)
Returns
The moved Directory.
Parameters
dThe Directory to move.
newDirThe new Directory.

◆ MoveFile()

File Pathfinder.GameFilesystem.Directory.MoveFile ( File  f,
Directory  newDir 
)
Returns
The moved File.
Parameters
fThe File to move.
newDirThe new Directory.

◆ MoveTo()

Directory Pathfinder.GameFilesystem.Directory.MoveTo ( Directory  to)
Returns
The Directory to move to.
Parameters
toThe moved Directory.

◆ RemoveDirectory() [1/2]

bool Pathfinder.GameFilesystem.Directory.RemoveDirectory ( string  name)
Returns
true, if Directory was found and removed, false otherwise.
Parameters
nameThe name to find.

◆ RemoveDirectory() [2/2]

bool Pathfinder.GameFilesystem.Directory.RemoveDirectory ( Directory  d)
Returns
true, if Directory was found and removed, false otherwise.
Parameters
dThe Directory to find.

◆ RemoveFile() [1/2]

bool Pathfinder.GameFilesystem.Directory.RemoveFile ( string  name)
Returns
true, if File was found and removed, false otherwise.
Parameters
nameThe name to find.

◆ RemoveFile() [2/2]

bool Pathfinder.GameFilesystem.Directory.RemoveFile ( File  f)
Returns
true, if File was found and removed, false otherwise.
Parameters
fThe File to find.

◆ SearchForDirectory() [1/2]

Directory Pathfinder.GameFilesystem.Directory.SearchForDirectory ( string  path,
bool  ignoreRootSymbol,
bool  nullOut = false 
)
Returns
The Directory to search for, or the deepest Directory found in the path, or null if nullOut is true.
Parameters
pathThe path to search by.
ignoreRootSymbolIf set to true ignores the root (/) symbol at the start.
nullOutIf set to true then nulls out on failure, otherwise returns furthest depth

◆ SearchForDirectory() [2/2]

Directory Pathfinder.GameFilesystem.Directory.SearchForDirectory ( string  path)
Returns
The Directory to search for, or the deepest Directory found in the path.
Parameters
pathThe path to search by.

◆ SearchForFile() [1/2]

File Pathfinder.GameFilesystem.Directory.SearchForFile ( string  path,
bool  ignoreRootSymbol 
)
Returns
The File to search for, or null if not found.
Parameters
pathThe path to search by.
ignoreRootSymbolIf set to true ignores the root (/) symbol at the start.

◆ SearchForFile() [2/2]

File Pathfinder.GameFilesystem.Directory.SearchForFile ( string  path)
Returns
The File to search for, or null if not found.
Parameters
pathThe path to search by.

Member Data Documentation

◆ Directories

List<Directory> Pathfinder.GameFilesystem.Directory.Directories => Object.folders.Select(f => new Directory(f, this)).ToList()

The directories.

◆ DirectoryCount

int Pathfinder.GameFilesystem.Directory.DirectoryCount => Object.folders.Count

◆ FileCount

int Pathfinder.GameFilesystem.Directory.FileCount => Object.files.Count

◆ Files

List<File> Pathfinder.GameFilesystem.Directory.Files => Object.files.Select(f => new File(f, this)).ToList()

◆ ParentDirectory

Directory Pathfinder.GameFilesystem.Directory.ParentDirectory => (Directory)Parent

The Parent as Directory

◆ Root

sealed override Filesystem Pathfinder.GameFilesystem.Directory.Root => Parent.Root

◆ this[string name]

IFileObject Pathfinder.GameFilesystem.Directory.this[string name] => (IFileObject)FindFile(name) ?? FindDirectory(name)
Parameters
nameName.

◆ Type

sealed override FileType Pathfinder.GameFilesystem.Directory.Type => FileType.Directory

Property Documentation

◆ Index

sealed override int Pathfinder.GameFilesystem.Directory.Index
getset

The folder index in the parent or -1 if root directory.

◆ Name

sealed override string Pathfinder.GameFilesystem.Directory.Name
getset

The name of the directory.

◆ Path

override string Pathfinder.GameFilesystem.Directory.Path
getset

The directory's path.


The documentation for this class was generated from the following file: