Uncompresses a file from a compressed archive.

syntaxSyntax:
DlxFile.UnzipFile(index, fileName)

Parameters

Parameter Description
index File index inside the compressed archive. The index must be between 0 and GetItemsCount-1.
fileName Relative or complete path of the target file.

Return Value

If the operation ends correctly it returns true otherwise it returns false.

Remarks

If a full path is not specified, each file path is assumed to be relative to the Drawlogix working directory. For example, the relative path "myscripts\firstscript.clxjs" is changed to the full path "c:\....\documents\alterlogix\drawlogix\myscripts\firstscript.clxjs".

Example

  Copy codeCopy code
var zip = new DlxFile("demo.zip", DlxApp.FILEOPEN_ZIP);
if (zip.IsValid())
{
  zip.AddText("demo.txt", "Text file demo.");
  zip.AddText("demo1.txt", "Text file demo 1.");
  zip.Close();
};
var unzip = new DlxFile("demo.zip", DlxApp.FILEOPEN_UNZIP);
if (unzip.IsValid())
{
  DlxApp.Printf("%i", unzip.GetItemsCount());
  for (var i = 0; i < unzip.GetItemsCount(); i++)
  {
    DlxApp.Printf("%i: [%i] %s", i, unzip.GetItemLength(i), unzip.GetItemName(i));
  }
  unzip.UnzipFile(0, "demo.txt");
  unzip.Close();
}

See also