An item with the same key has already been added

Jun 30, 2011 at 3:53 PM

Hello,

I have a problem when i add my folder to my zip.

I would like to skip the adding folder if it already added in my ZipFile.

I'm coding in C++/CLI :

sr_File = gcnew StreamReader (s_File);
s_Line = sr_File -> ReadLine ();
while (s_Line != nullptr)
{
	char* stringPointer = (char*) Marshal::StringToHGlobalAnsi (s_Line).ToPointer ();
	string std_Name = stringPointer;
	i_Index = std_Name.find ("Jean");

	if (i_Index != -1)
	{
		s_Name = gcnew String (std_Name.c_str());
							
		if (//If File already Exist in Zip)
		{
			zf_Zip -> AddDirectory ("D:\\" + s_Name, "D:\\" + s_Name);
		}
	}
	s_Line = sr_File -> ReadLine ();
}

 

Jul 1, 2011 at 9:47 AM

I try ContainsEntry but it's doesn't work :/

Jul 4, 2011 at 11:59 AM
Edited Jul 4, 2011 at 5:58 PM

i've got the same problem but when unziping in c#, that is my code:

when the compiler enters into the using statement it got the exception:

"An iten with the same key has already been added", does anybody know what shoul be wrong"

when i change destinationFolder to a path in my network it works:

 

 using (ZipFile zip = ZipFile.Read(arquivo))
            {

                foreach (ZipEntry e in zip)
                {
                    e.Extract(destinationFolder, ExtractExistingFileAction.OverwriteSilently);
                }
             
            }
Jul 4, 2011 at 1:19 PM
Edited Jul 4, 2011 at 5:58 PM

Nervermind, already resolved, actually there were duplicated files inside my zip.