private static void RemoveFromArchive(ZipFile zip, string fileToRemove)
{
try
{
if (zip.ContainsEntry(fileToRemove))
{
zip.RemoveEntry(fileToRemove);
}
else
{
List<string> toRemove = new List<string>();
foreach (ZipEntry e in zip)
{
if (e.FileName.StartsWith(fileToRemove + "/")) toRemove.Add(e.FileName);
}
foreach (string element in toRemove)
{
zip.RemoveEntry(element);
}
}
}
catch (Exception ex)
{
Utilities.OnError(Utilities.GetCurrentMethod(), ex);
}
}