Skip to content

ArchiveEntry

Type

ArchiveEntry

The ArchiveEntry type represents an entry in SLADE.

Properties

Property Type Description
name string The entry name.
As an example, for an entry Actors/Weapons/Gun1.txt this will be Gun1.txt
path string The path to the entry in the archive, beginning and ending with /.
As an example, for an entry Actors/Weapons/Gun1.txt, this will be /Actors/Weapons/. If the entry isn't in a directory this will be just /
type EntryType The entry's type information
size integer The size of the entry in bytes
data DataBlock The entry's data
index integer The index of the entry within its containing archive or directory
crc32 integer The 32-bit crc value calculated from the entry's data
parentArchive Archive The Archive that contains this entry
parentDir ArchiveDir The ArchiveDir that contains this entry

Constructors

No Constructors

This type can not be created directly in scripts.

See:

Functions

Overview

General

FormattedName([includePath], [includeExtension], [upperCase]) -> string FormattedSize() -> string Rename(newName)

Data Import/Export

ExportFile(path) -> boolean, string ImportData(dataString) -> boolean, string ImportData(data) -> boolean, string ImportEntry(entry) -> boolean, string ImportFile(path) -> boolean, string


FormattedName

Gets the entry name, formatted depending on the parameters given.

Parameters

  • [includePath] (boolean): Whether to include the entry path. Default is true
  • [includeExtension] (boolean): Whether to include the entry extension. Default is true
  • [upperCase] (boolean): Whether to convert the entry name to uppercase. Default is false

Returns

  • string: A formatted name of the entry, depending on the parameters given

Notes

Note that upperCase will not affect the path.


FormattedSize

Gets the size of the entry in a formatted string, eg. 1.3kb

Returns

  • string: The size of the entry

Rename

Renames the entry.

Parameters

  • newName (string): The new name for the entry

Notes

If the entry has a parent Archive, the archive's naming rules will be applied to the new name (see ArchiveFormat).


ExportFile

Exports the entry data to a file at path.

Parameters

  • path (string): The full path to the file to export

Returns

  • boolean: true if the export succeeded
  • string: An error message if the export failed

Notes

If a file already exists at path, it will be overwritten.


ImportData (1)

Imports dataString into the entry.

Parameters

  • dataString (string): The data to import

Returns

  • boolean: true if the import succeeded
  • string: An error message if the import failed

ImportData (2)

Imports data into the entry.

Parameters

Returns

  • boolean: true if the import succeeded
  • string: An error message if the import failed

ImportEntry

Imports (copies) the data from entry.

Parameters

  • entry (ArchiveEntry): The entry to import data from

Returns

  • boolean: true if the import succeeded
  • string: An error message if the import failed

ImportFile

Imports the file at the given path into the entry.

Parameters

  • path (string): The full path to the file to import

Returns

  • boolean: true if the import succeeded
  • string: An error message if the import failed