User (Old forums)MemberMay 6, 2009 at 4:38 amPost count: 23064
In code I create a zip file on a location like C:\test.zip.
Then I want to check the zip if its valid (no errors occurred).
Then i copy the file from C\:test.zip to D\:test.zip.
Then i check/verify again.
Now i just creating the zip and copy it.
But how can i verify it?
Imported from legacy forums. Posted by Insider (had 2759 views)User (Old forums)MemberMay 6, 2009 at 4:24 pmPost count: 23064
There is no method to do this automatically. The only option you have is to open a stream on the zip archive, and unzip files, without doing anything with the stream. This will minimize memory using for the operation, and will ensure the archive’s integrity if no exception is thrown.
AbstractFile zipFile = new DiskFile( @”D:\Temp\test.zip” );
ZipArchive archive = new ZipArchive( zipFile );
foreach( ZippedFile file in archive.GetFiles( true ) )
//you can log the file name for example if you want to keep a trace of what you are doing
System.Diagnostics.Debug.WriteLine( file.Name );
using( Stream fileStream = file.OpenRead() )
byte buffer = new byte[ 32768 ];
int bytesRead = 0;
while( ( bytesRead = fileStream.Read( buffer, 0, buffer.Length ) ) > 0 )
catch( Exception e )
System.Diagnostics.Debug.WriteLine( e.ToString() );
Imported from legacy forums. Posted by André (had 1723 views)User (Old forums)MemberMay 7, 2009 at 6:01 amPost count: 23064
It seems to work, but i need to set the encryption password.
How can i set the password?
Imported from legacy forums. Posted by Insider (had 1813 views)User (Old forums)MemberMay 7, 2009 at 11:09 pmPost count: 23064
Use the overloaded method that takes an password on file.OpenRead().
Imported from legacy forums. Posted by André (had 2150 views)
- You must be logged in to reply to this topic.