Skip to content

Instantly share code, notes, and snippets.

@sri-prasanna
Last active August 29, 2015 13:56
Show Gist options
  • Save sri-prasanna/8874407 to your computer and use it in GitHub Desktop.
Save sri-prasanna/8874407 to your computer and use it in GitHub Desktop.
ZipFile.Delete on a folder entry fails #48
...
...
...
...
int FindExistingUpdate(ZipEntry entry)
{
int result = -1;
string convertedName = GetTransformedFileName(entry.Name);
if (updateIndex_.ContainsKey(convertedName))
{
result = (int) updateIndex_[convertedName];
}
else
{
convertedName = GetTransformedDirectoryName(entry.Name);
if (updateIndex_.ContainsKey(convertedName))
{
result = (int)updateIndex_[convertedName];
}
}
/*
// This is slow like the coming of the next ice age but takes less storage and may be useful
// for CF?
for (int index = 0; index < updates_.Count; ++index)
{
ZipUpdate zu = ( ZipUpdate )updates_[index];
if ( (zu.Entry.ZipFileIndex == entry.ZipFileIndex) &&
(string.Compare(convertedName, zu.Entry.Name, true, CultureInfo.InvariantCulture) == 0) ) {
result = index;
break;
}
}
*/
return result;
}
...
...
...
...
...
...
...
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment