swiftlys2/docs/api/ai/
API Reference FileSystem

IGameFileSystem

Interface
Namespace: SwiftlyS2.Shared.FileSystem · Assembly: SwiftlyS2.CS2.dll
public interface IGameFileSystem
View source

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
  • filePathstringThe file path to check.
  • pathIdstringThe ID of the path to check in.
Returns
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
  • wildcardstringThe wildcard to match files against.
  • pathIdstringThe ID of the path to search in.
Returns
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
  • filePathstringThe path to the file to get the size of.
  • pathIdstringThe ID of the path to get the file size from.
Returns
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
  • pathIdstringThe ID of the path to get the search paths for.
  • searchPathTypeGetSearchPathTypes_tThe type of search path to get.
  • searchPathsToGetintThe number of search paths to get.
Returns
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
  • pathstringThe path to check.
  • pathIdstringThe ID of the path to search in.
Returns
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
  • filePathstringThe path to the file to check.
  • pathIdstringThe ID of the path to check in.
Returns
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
  • filePathstringThe path to the file to precache.
  • pathIdstringThe ID of the path to precache the file in.
Returns
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
  • filePathstringThe path to the file to read.
  • pathIdstringThe ID of the path to read the file from.
Returns
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
  • pathstringThe path to remove.
  • pathIdstringThe ID of the path to remove in.
Returns
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
  • filePathstringThe path to the file to set the writable status for.
  • pathIdstringThe ID of the path to set the writable status in.
  • writableboolTrue to make the file writable, false to make it read-only.
Returns
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
  • filePathstringThe path to the file to write.
  • pathIdstringThe ID of the path to write the file to.
  • contentstringThe content to write to the file.
Returns
True if the file was written successfully, false otherwise.