Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_FileIOHelper Class Reference

Protected Member Functions

void SCR_FileIOHelper ()

Static Protected Member Functions

static bool CreateDirectory (string absoluteDirectory)
static array< stringFindFiles (string directoryPath, string extension)
static bool Copy (string source, string destination, bool overwrite=true)
static bool CopyFile (string sourceFile, string destinationFile)
static bool CopyDirectory (string sourceDirectory, string destinationDirectory)
static bool RenameFile (string sourceFile, string destinationFile)
static string GetFileStringContent (string filePath, bool printWarning=true)
static array< ref SCR_FileInfo > GetDirectoryContent (string directory, string extension="")
static array< stringReadFileContent (string filePath, bool printWarning=true)
static bool WriteFileContent (string filePath, notnull array< string > lines)
static bool AppendFileContent (string filePath, notnull array< string > lines)
static bool IsValidFileName (string fileName)
static string SanitiseFileName (string fileName)
static bool IsWindowsBased ()
static void FindFilesCallbackMethod (string fileName, FileAttribute attributes=0, string filesystem=string.Empty)
static string GetShortResourceName (ResourceName rn)

Static Protected Attributes

static const string PATH_DELIMITER = SCR_StringHelper.SLASH
static const string FORBIDDEN_FILENAME_CHARS_WINDOWS = "*/\<>:|?\t\r\n\""
static const string FORBIDDEN_FILENAME_CHARS_LINUX = SCR_StringHelper.SLASH
static const ref array< ref SCR_FileInfo > FOUND_FILEINFOS = {}

Detailed Description

Definition at line 1 of file SCR_FileIOHelper.c.

Constructor & Destructor Documentation

◆ SCR_FileIOHelper()

void SCR_FileIOHelper::SCR_FileIOHelper ( )
protected

Member Function Documentation

◆ AppendFileContent()

bool SCR_FileIOHelper::AppendFileContent ( string filePath,
notnull array< string > lines )
inlinestaticprotected

Write all lines in the file after its existing content Adds to the file if it exists, creates it otherwise

Parameters
[in]filePathrelative or absolute
[in]lines
Returns
true on success, false otherwise

Definition at line 338 of file SCR_FileIOHelper.c.

◆ Copy()

bool SCR_FileIOHelper::Copy ( string source,
string destination,
bool overwrite = true )
inlinestaticprotected

Copy source file to destination

Parameters
[in]sourcefile to copy
[in]destinationcopy destination
[in]overwriteset to false to prevent an accidental overwrite
Returns
true on success, false otherwise

Definition at line 75 of file SCR_FileIOHelper.c.

◆ CopyDirectory()

bool SCR_FileIOHelper::CopyDirectory ( string sourceDirectory,
string destinationDirectory )
inlinestaticprotected

Recursively copy a directory to another, existing or not. Overwrite is allowed so check before copying

Parameters
[in]sourceDirectorycan be relative or absolute
[in]destinationDirectorycan be relative or absolute
Returns
true on success, false otherwise - it will (try to) copy all files, not halt on the first error

Definition at line 132 of file SCR_FileIOHelper.c.

◆ CopyFile()

bool SCR_FileIOHelper::CopyFile ( string sourceFile,
string destinationFile )
inlinestaticprotected

Copy source file to destination - creating the destination directory if needed

Parameters
[in]sourceFile
[in]destinationFile
Returns
true on success, false otherwise

Definition at line 113 of file SCR_FileIOHelper.c.

◆ CreateDirectory()

bool SCR_FileIOHelper::CreateDirectory ( string absoluteDirectory)
inlinestaticprotected

OBSOLETE - use FileIO.MakeDirectory instead
Create sub-directories in the proper order, circumventing a FileIO.MakeDirectory limitation

Parameters
[in]absoluteDirectorye.g C:/Arma4/Data/scripts/My/Sub/Directory
Returns
true if the whole directory structure was created or already exists, false otherwise

Definition at line 15 of file SCR_FileIOHelper.c.

◆ FindFiles()

array< string > SCR_FileIOHelper::FindFiles ( string directoryPath,
string extension )
inlinestaticprotected
Parameters
[in]directoryPath
[in]extension
Returns

Definition at line 61 of file SCR_FileIOHelper.c.

◆ FindFilesCallbackMethod()

void SCR_FileIOHelper::FindFilesCallbackMethod ( string fileName,
FileAttribute attributes = 0,
string filesystem = string.Empty )
inlinestaticprotected

Definition at line 469 of file SCR_FileIOHelper.c.

◆ GetDirectoryContent()

array< ref SCR_FileInfo > SCR_FileIOHelper::GetDirectoryContent ( string directory,
string extension = "" )
inlinestaticprotected
Parameters
[in]directorythe directory to browse
[in]extensionthe extension of files for which to look
Returns
array of file information or null on error

Definition at line 256 of file SCR_FileIOHelper.c.

◆ GetFileStringContent()

string SCR_FileIOHelper::GetFileStringContent ( string filePath,
bool printWarning = true )
inlinestaticprotected

Get file content as one big string

Parameters
[in]filePathrelative or absolute
[in]printWarningtrue to print warning on issue, false otherwise
Returns
raw string file content or empty string if file does not exist or cannot be opened

Definition at line 234 of file SCR_FileIOHelper.c.

◆ GetShortResourceName()

string SCR_FileIOHelper::GetShortResourceName ( ResourceName rn)
inlinestaticprotected

Strips the resource name of the path while preserving the GUID and file name

Parameters
[in]resourceName
Returns
{GUID}FileName.Extension

Definition at line 482 of file SCR_FileIOHelper.c.

◆ IsValidFileName()

bool SCR_FileIOHelper::IsValidFileName ( string fileName)
inlinestaticprotected

Get whether or not a file name is valid for the filesystem

Parameters
[in]fileNamethe file name to be sanitised - no file path accepted
Returns
true if the provided file name is valid under the current OS, false otherwise

Definition at line 379 of file SCR_FileIOHelper.c.

◆ IsWindowsBased()

bool SCR_FileIOHelper::IsWindowsBased ( )
inlinestaticprotected
Returns
true if Windows or Xbox, false otherwise

Definition at line 455 of file SCR_FileIOHelper.c.

◆ ReadFileContent()

array< string > SCR_FileIOHelper::ReadFileContent ( string filePath,
bool printWarning = true )
inlinestaticprotected

Get file content as array of lines

Parameters
[in]filePathrelative or absolute
[in]printWarningtrue to print warning on issue, false otherwise
Returns
array of lines or null if file does not exist or cannot be opened

Definition at line 272 of file SCR_FileIOHelper.c.

◆ RenameFile()

bool SCR_FileIOHelper::RenameFile ( string sourceFile,
string destinationFile )
inlinestaticprotected

Fake a renaming by copying then deleting the source file

Parameters
[in]sourceFile
[in]destinationFile
Returns
true on success, false on failure (no

Definition at line 224 of file SCR_FileIOHelper.c.

◆ SanitiseFileName()

string SCR_FileIOHelper::SanitiseFileName ( string fileName)
inlinestaticprotected

Sanitise the provided file name (removes invalid characters depending on the current OS, directory information, etc)

Parameters
[in]fileNamethe file name to be sanitised - can take a file path that will be stripped
Returns
the sanitised, trimmed file name or empty string if no characters are viable

Definition at line 410 of file SCR_FileIOHelper.c.

◆ WriteFileContent()

bool SCR_FileIOHelper::WriteFileContent ( string filePath,
notnull array< string > lines )
inlinestaticprotected

Write all lines in the file, replacing all its content Overwrites the file if it exists

Parameters
[in]filePathrelative or absolute
[in]lines
Returns
true on success, false otherwise

Definition at line 301 of file SCR_FileIOHelper.c.

Member Data Documentation

◆ FORBIDDEN_FILENAME_CHARS_LINUX

const string SCR_FileIOHelper::FORBIDDEN_FILENAME_CHARS_LINUX = SCR_StringHelper.SLASH
staticprotected

Definition at line 5 of file SCR_FileIOHelper.c.

◆ FORBIDDEN_FILENAME_CHARS_WINDOWS

const string SCR_FileIOHelper::FORBIDDEN_FILENAME_CHARS_WINDOWS = "*/\<>:|?\t\r\n\""
staticprotected

Definition at line 4 of file SCR_FileIOHelper.c.

◆ FOUND_FILEINFOS

const ref array<ref SCR_FileInfo> SCR_FileIOHelper::FOUND_FILEINFOS = {}
staticprotected

Definition at line 7 of file SCR_FileIOHelper.c.

◆ PATH_DELIMITER

const string SCR_FileIOHelper::PATH_DELIMITER = SCR_StringHelper.SLASH
staticprotected

Definition at line 3 of file SCR_FileIOHelper.c.


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