SwiftlyS2

IGameFileSystem

Interface IGameFileSystem

Namespace: SwiftlyS2.Shared.FileSystem

Assembly: SwiftlyS2.CS2.dll

public interface IGameFileSystem

Methods

AddSearchPath(string, string, SearchPathAdd_t, SearchPathPriority_t)

Adds a search path to the file system.

void AddSearchPath(string path, string pathId, SearchPathAdd_t addType, SearchPathPriority_t priority)
Parameters

FileExists(string, string)

Checks if a file exists at the given file path and path ID.

bool FileExists(string filePath, string pathId)
Parameters
  • filePath string — The file path to check.
  • pathId string — The ID of the path to check in.
Returns
  • bool — True if the file exists, false otherwise.

FindFileAbsoluteList(string, string)

Finds all files matching the given wildcard and path ID.

List<string> FindFileAbsoluteList(string wildcard, string pathId)
Parameters
  • wildcard string — The wildcard to match files against.
  • pathId string — The ID of the path to search in.
Returns
  • List<string> — A list of all files matching the given wildcard and path ID.

GetFileSize(string, string)

Gets the size of a file at the given file path and path ID.

uint GetFileSize(string filePath, string pathId)
Parameters
  • filePath string — The path to the file to get the size of.
  • pathId string — The ID of the path to get the file size from.
Returns
  • uint — The size of the file in bytes.

GetSearchPath(string, GetSearchPathTypes_t, int)

Gets the search path(s) for the given path ID and search path type.

string GetSearchPath(string pathId, GetSearchPathTypes_t searchPathType, int searchPathsToGet)
Parameters
  • pathId string — The ID of the path to get the search paths for.
  • searchPathType GetSearchPathTypes_t — The type of search path to get.
  • searchPathsToGet int — The number of search paths to get.
Returns
  • string — The search path(s) for the given path ID and search path type.

IsDirectory(string, string)

Checks if a directory exists at the given path and path ID.

bool IsDirectory(string path, string pathId)
Parameters
  • path string — The path to check.
  • pathId string — The ID of the path to search in.
Returns
  • bool — True if the directory exists, false otherwise.

IsFileWritable(string, string)

Checks if a file is writable at the given file path and path ID.

bool IsFileWritable(string filePath, string pathId)
Parameters
  • filePath string — The path to the file to check.
  • pathId string — The ID of the path to check in.
Returns
  • bool — True if the file is writable, false otherwise.

PrecacheFile(string, string)

Precaches a file at the given file path and path ID.

bool PrecacheFile(string filePath, string pathId)
Parameters
  • filePath string — The path to the file to precache.
  • pathId string — The ID of the path to precache the file in.
Returns
  • bool — True if the file was precached successfully, false otherwise.

PrintSearchPaths()

Prints the current search paths to the console.

void PrintSearchPaths()

ReadFile(string, string)

Reads the contents of a file at the given file path and path ID.

string ReadFile(string filePath, string pathId)
Parameters
  • filePath string — The path to the file to read.
  • pathId string — The ID of the path to read the file from.
Returns
  • string — The contents of the file as a string.

RemoveSearchPath(string, string)

Removes a search path from the file system.

bool RemoveSearchPath(string path, string pathId)
Parameters
  • path string — The path to remove.
  • pathId string — The ID of the path to remove in.
Returns
  • bool — True if the path was removed successfully, false otherwise.

SetFileWritable(string, string, bool)

Sets the writable status of a file at the given file path and path ID.

bool SetFileWritable(string filePath, string pathId, bool writable)
Parameters
  • filePath string — The path to the file to set the writable status for.
  • pathId string — The ID of the path to set the writable status in.
  • writable bool — True to make the file writable, false to make it read-only.
Returns
  • bool — True if the writable status was set successfully, false otherwise.

WriteFile(string, string, string)

Writes content to a file at the given file path and path ID.

bool WriteFile(string filePath, string pathId, string content)
Parameters
  • filePath string — The path to the file to write.
  • pathId string — The ID of the path to write the file to.
  • content string — The content to write to the file.
Returns
  • bool — True if the file was written successfully, false otherwise.

On this page