I try using this Code :
public void Extract(string SourceFile, string password)
{
SevenZipExtractor szip = new SevenZipExtractor(SourceFile, password);
foreach (DataGridViewRow row in DGVFile.Rows)
{
string NameFile = (string)row.Cells[0].Value;
int indexZip = szip.ArchiveFileData.IndexOf(NameFile);
Stream pathDirectory = @"C:\\";
szip.ExtractFile(indexZip, pathDirectory);
}
}
But thats Error, in line 7 and 8. Maybe anyone can explain how to get the index file in my archive with the name that has been chosen in my datagridview and also the purpose of the File Stream in variable pathDirectory. Thanks
Edit: i use DataGridView DGVDekripsi, so i replaced it. This correct code, It works.
public void Extract(string SourceFile, string password)
{
string OutputLocation = txtOutputDe.Text;
SevenZipExtractor szip = new SevenZipExtractor(SourceFile, password);
foreach (DataGridViewRow row in DGVDekripsi.Rows)
{
string NameFile = (string)row.Cells[1].Value;
FileStream fs = File.OpenWrite(Path.Combine(OutputLocation, NameFile));
szip.ExtractFile(NameFile, fs );
}
return;
}