Search for a file within a compressed archive based on the file extension.

syntaxSyntax:
DlxFile.FindItemByExt(ext, start=0)

Parameters

Parameter Description
ext The file extension to search for.
start The index from which to begin the search.

Return Value

If the operation finishes successfully, it returns the index (starting with 0) of the file, otherwise it returns -1.

Example

  Copy codeCopy code
// Acquire the file to import
var file = new DlxFile("", DlxApp.FILEOPEN_OPENDIALOG|DlxApp.FILEOPEN_ALLFILES, -1, "Component Interchange Format|*.cxf|Compressed archive|*.zip");
if (file.IsValid())
{
  if (file.GetFileExt() == ".zip")
  {
    // If it is a compressed archive, look for the .cxf file
    if (file.Open(DlxApp.FILEOPEN_UNZIP))
      file.Open(DlxApp.FILEOPEN_UNZIPTEXT, file.FindItemByExt(".cxf"));
  }
  else
  {
    // If it is a .cxf file simply open it
    file.Open(DlxApp.FILEOPEN_READTEXT);
  }
  // Reading .CXF file
  while (!file.IsEOF())
    DlxApp.Printf(file.ReadLine());
}

See also