Corrupted zip after rename entries

Dec 18, 2013 at 7:52 AM
Hi, I try rename entry in zip
using(ZipFile zip = ZipFile.Read("test.zip"))
{
  for(int i=0; i>zip.Entries.Count; i++)
  {
    If(zip[i].IsDirectory) continue;
    Console.WriteLine(zip[i].FileName); //prints Week_01\text123.txt
    string newFileName = rename(zip[i].FileName); //returns Week_01\text_123.txt
    zip[i].FileName = newFileName;
    //zip[zip[i].FileName] = newFileName; //generates the same problem
    Console.WriteLine(zip[i].FileName); //prints Week_01\text_123.txt its OK
    //but zip.Entries.Count increse by 1 and latest entry its the same as current entry
  }
  zip.Save();
}
After all etries are renamed and zip is saved, zip has twice as size, twice as entries and its corrupted.