I have to list all the information available inside a zip file (FileName, lenght, date created, modified, and so on). Some zip files that I have to analyze come with folders and zip files inside of them as well as other file types.
I was wondering how to read these folders and contents inside of the zip file and also the zip entry inside the zip file without having to unzip the whole thing (if it is even possible)
e.g.:
Collection.zip file1.txt file2.txt reports/ report1.txt report2.txt first-backup.zip second-backup.zip
With the sharp zip library I'm able to read the first layer of files by doing:
foreach (Zip_Library.Zip.ZipEntry entry in new Zip_Library.Zip.ZipFile(fi.FullName))
{
printObjectProps(entry);
}
And printObjectProps looks kinda like this:
private static void printObjectProps(Object obj)
{
Console.WriteLine("--------------------------------------------");
Console.WriteLine("ObjectType:" + obj.GetType().ToString());
Console.WriteLine("--------------------------------------------");
foreach (PropertyInfo propInfo in obj.GetType().GetProperties())
{
Console.WriteLine("PropertyName:" + propInfo.Name);
Console.WriteLine("PropertyType:" + propInfo.PropertyType);
Console.WriteLine("PropertyValue:" + propInfo.GetValue(obj, null));
Console.WriteLine();
}
Console.WriteLine("--------------------------------------------");
}
Any ideas I should consider before I get myself into more trouble??