Search for a file within a compressed archive based on the file name.
Syntax: |
DlxFile.FindItemByName(name, start=0)
|
Parameters
Parameter |
Description |
name |
The file name 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 code
|
var zip = new DlxFile("demo.zip", DlxApp.FILEOPEN_ZIP);
if (zip.IsValid())
{
zip.AddText("demo.txt", "Text file demo.");
zip.AddText("folder1/demo1.txx", "Text file demo 1.");
zip.Close();
};
var unzip = new DlxFile("demo.zip", DlxApp.FILEOPEN_UNZIP);
if (unzip.IsValid())
{
DlxApp.Printf(".txt at index %i", unzip.FindItemByName("demo1.txx"));
unzip.Close();
}
|
See also