DayZ 1.24
Loading...
Searching...
No Matches
FileIO API
Collaboration diagram for FileIO API:

Typedefs

typedef int[] ParseHandle
 
typedef int[] FileHandle
 
typedef int[] FindFileHandle
 

Enumerations

enum  FileMode { READ , WRITE , APPEND }
 
enum  FileAttr { DIRECTORY , HIDDEN , READONLY , INVALID }
 
enum  FindFileFlags
 

Functions

proto native ParseHandle BeginParse (string filename)
 
proto int ParseLine (ParseHandle tp, int num, string tokens[])
 
proto native void EndParse (ParseHandle file)
 
proto bool FileExist (string name)
 Check existence of file.
 
proto FileHandle OpenFile (string name, FileMode mode)
 Opens File.
 
proto int ReadFile (FileHandle file, void param_array, int length)
 
proto void CloseFile (FileHandle file)
 Close the File.
 
proto void FPrint (FileHandle file, void var)
 Write to file.
 
proto void FPrintln (FileHandle file, void var)
 Write to file and add new line.
 
proto int FGets (FileHandle file, string var)
 Get line from file, every next call of this function returns next line.
 
enum FindFileFlags FindFile (string pattern, out string fileName, out FileAttr fileAttributes, FindFileFlags flags)
 
proto bool FindNextFile (FindFileHandle handle, out string fileName, out FileAttr fileAttributes)
 
proto native void CloseFindFile (FindFileHandle handle)
 
proto native bool MakeDirectory (string name)
 Makes a directory.
 
proto native bool DeleteFile (string name)
 delete file. Works only on "$profile:" and "$saves:" locations
 
proto native bool CopyFile (string sourceName, string destName)
 copy file. destName must be "$profile:" or "$saves:" location
 

Detailed Description

Typedef Documentation

◆ FileHandle

Definition at line 390 of file EnSystem.c.

◆ FindFileHandle

Definition at line 503 of file EnSystem.c.

◆ ParseHandle

Definition at line 389 of file EnSystem.c.

Enumeration Type Documentation

◆ FileAttr

Enumerator
DIRECTORY 

File is directory.

HIDDEN 

File is hidden.

READONLY 

File is read-only.

INVALID 

Invalid file.

Definition at line 505 of file EnSystem.c.

506{
507 DIRECTORY,
508 HIDDEN,
509 READONLY,
510 INVALID
511};
@ HIDDEN
File is hidden.
Definition EnSystem.c:508
@ READONLY
File is read-only.
Definition EnSystem.c:509
@ DIRECTORY
File is directory.
Definition EnSystem.c:507
@ INVALID
Invalid file.
Definition EnSystem.c:510

◆ FileMode

Enumerator
READ 
WRITE 
APPEND 

Definition at line 382 of file EnSystem.c.

383{
384 READ,
385 WRITE,
386 APPEND
387};
@ WRITE
Definition EnSystem.c:385
@ READ
Definition EnSystem.c:384
@ APPEND
Definition EnSystem.c:386

◆ FindFileFlags

Definition at line 513 of file EnSystem.c.

514{
516 ARCHIVES,
517 ALL
518}
ALL
<Looks in archives and fs directories.
Definition EnSystem.c:3
ARCHIVES
Looks for files in archive only. (.pak)
Definition EnSystem.c:1
DIRECTORIES
Looks for files in fs directories only.
Definition EnSystem.c:0

Function Documentation

◆ BeginParse()

proto native ParseHandle BeginParse ( string filename)

◆ CloseFile()

proto void CloseFile ( FileHandle file)

Close the File.

Parameters
fileFile handle ID of a opened file
Returns
void
usage :
FileHandle file = OpenFile("$profile:testiik.txt", FileMode.WRITE);
if (file != 0)
{
FPrintln(file, "line1");
FPrintln(file, "line2");
FPrintln(file, "line3");
}
FileMode
Definition EnSystem.c:383
proto void CloseFile(FileHandle file)
Close the File.
proto FileHandle OpenFile(string name, FileMode mode)
Opens File.
proto void FPrintln(FileHandle file, void var)
Write to file and add new line.

Referenced by Debug::ClearLogs(), PluginRecipesManagerBase::GenerateHumanReadableRecipeList(), GetControlMappingInfo(), UIScriptedMenu::GetControlMappingInfo(), JsonFileLoader< Class T >::JsonLoadFile(), JsonFileLoader< Class T >::JsonSaveFile(), PluginBase::LoadFile(), JsonFileLoader< Class T >::LoadFile(), ScriptConsoleOutputTab::ReloadOutput(), PluginBase::SaveFile(), JsonFileLoader< Class T >::SaveFile(), and Debug::SaveLog().

◆ CloseFindFile()

◆ CopyFile()

proto native bool CopyFile ( string sourceName,
string destName )

copy file. destName must be "$profile:" or "$saves:" location

Referenced by PluginBase::FileDuplicate().

◆ DeleteFile()

proto native bool DeleteFile ( string name)

delete file. Works only on "$profile:" and "$saves:" locations

Referenced by PluginBase::FileDelete().

◆ EndParse()

proto native void EndParse ( ParseHandle file)

◆ FGets()

proto int FGets ( FileHandle file,
string var )

Get line from file, every next call of this function returns next line.

Parameters
fileFile handle ID of a opened file
varValue to write
Returns
int Count of chars or -1 if is not any for read (end of file is EMPTY line)
usage :
FileHandle file_handle = OpenFile("$profile:testiik.txt", FileMode.READ);
string line_content;
while ( FGets( file_handle, line_content ) > 0 )
{
}
proto void Print(void var)
Prints content of variable to console/log.
proto int FGets(FileHandle file, string var)
Get line from file, every next call of this function returns next line.

Referenced by GetControlMappingInfo(), UIScriptedMenu::GetControlMappingInfo(), JsonFileLoader< Class T >::JsonLoadFile(), PluginBase::LoadFile(), JsonFileLoader< Class T >::LoadFile(), and ScriptConsoleOutputTab::ReloadOutput().

◆ FileExist()

◆ FindFile()

◆ FindNextFile()

◆ FPrint()

proto void FPrint ( FileHandle file,
void var )

Write to file.

Parameters
fileFile handle ID of a opened file
varValue to write
Returns
void
usage :
FileHandle file = OpenFile("$profile:testiik.txt", FileMode.WRITE);
if (file != 0)
{
FPrint(file, "A");
FPrint(file, "B");
FPrint(file, "C");
}
proto void FPrint(FileHandle file, void var)
Write to file.

Referenced by JsonFileLoader< Class T >::JsonSaveFile(), and JsonFileLoader< Class T >::SaveFile().

◆ FPrintln()

proto void FPrintln ( FileHandle file,
void var )

Write to file and add new line.

Parameters
fileFile handle ID of a opened file
varValue to write
Returns
void
usage :
FileHandle file = OpenFile("$profile:testiik.txt", FileMode.WRITE);
if (file != 0)
{
FPrintln(file, "line1");
FPrintln(file, "line2");
FPrintln(file, "line3");
}

Referenced by Debug::ClearLogs(), PluginRecipesManagerBase::GenerateHumanReadableRecipeList(), PluginBase::SaveFile(), Debug::SaveLog(), and Canvas::SaveToFile().

◆ MakeDirectory()

◆ OpenFile()

proto FileHandle OpenFile ( string name,
FileMode mode )

Opens File.

Parameters
nameof a file to open, (you can use filesystem prefixes ('$profile','$saves','$mission'). For accessing profile dir use '$profile', e.g. '$profile:myfilename.txt')
modeconstants FileMode.WRITE, FileMode.READ or FileMode.APPEND flag can be used
Returns
file handle ID or 0 if fails
usage :
FileHandle file = OpenFile("$profile:testiik.txt", FileMode.WRITE);
//FileHandle file = OpenFile("$profile:testiik.txt", FileMode.APPEND);
if (file != 0)
{
FPrintln(file, "line1");
FPrintln(file, "line2");
FPrintln(file, "line3");
}

Referenced by Debug::ClearLogs(), PluginRecipesManagerBase::GenerateHumanReadableRecipeList(), GetControlMappingInfo(), UIScriptedMenu::GetControlMappingInfo(), JsonFileLoader< Class T >::JsonLoadFile(), JsonFileLoader< Class T >::JsonSaveFile(), PluginBase::LoadFile(), JsonFileLoader< Class T >::LoadFile(), ScriptConsoleOutputTab::ReloadOutput(), PluginBase::SaveFile(), JsonFileLoader< Class T >::SaveFile(), Debug::SaveLog(), and Canvas::SaveToFile().

◆ ParseLine()

proto int ParseLine ( ParseHandle tp,
int num,
string tokens[] )

◆ ReadFile()

proto int ReadFile ( FileHandle file,
void param_array,
int length )

Reads raw data from file.

Parameters
param_arrayReceiving array for the data. Valid types are int[] or string
lengthLength of data
Returns
number of read bytes