PackageUng Class
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScipt (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
This class is used to operate with UNG packages.
The maximum size for a file inside a UNG package is limited to 2 GB.
PackageUng Class
Members
static PackageUng ( string password = 0, int compression_type = 2 ) #
Constructor. Creates a package using specified compression type, protected by a given password, if provided. By default a package is created using ZLIB compression and without password protection.Arguments
- string password - Password.
- int compression_type - Compression type. One of the COMPRESSION_* variables.
PackageUng clone ( ) #
Clones the package.void close ( ) #
Closes the package.int createPackage ( string name ) #
Creates a package with a given name.Arguments
- string name - Package name.
Return value
1 if a package was created successfully; otherwise, 0.int getCompressionType ( ) #
Returns the type of compression used in the package.Return value
Compression type. One of the COMPRESSION_* variables.string getFileName ( int num ) #
Returns the name of a file with a given ID.Arguments
- int num - File ID. A number between 0 and the total number of files in the package.
Return value
File name.int getNumFiles ( ) #
Returns the number of files in the package.Return value
Number of files.int isSupported ( ) #
Returns a value indicating if UNG-packages are supported.Return value
1 if UNG packages are supported; otherwise, 0.UNG-packages are not supported in evaluation version.
int load ( string name ) #
Loads a package with a given name.Arguments
- string name
Return value
1 if a package was loaded successfully; otherwise, 0.int readFile ( ??? byte[] data, int size ) #
Reads the contents of the currently selected file and puts it into the data array.This operation is performed for a currently selected file. To select a file use selectFile().
Arguments
- ??? byte[] data - Data array.
- int size - File size, in bytes.
Return value
1 if a file was read successfully; otherwise, 0.int selectFile ( string name, int & size ) #
Selects a file with a given name as a current one and puts its size to size.Arguments
- string name
- int & size - Integer variable to store the size of the selected file.
Return value
1 if a file was selected successfully; otherwise, 0.int writeFile ( string name, ??? byte[] data, int size ) #
Writes data to a file with a given name.Arguments
- string name
- ??? byte[] data - Data to be written.
- int size - Size of the data to be written, in bytes.
Return value
1 if the data was successfully written to a file; otherwise, 0.Last update:
2020-07-31
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)