Hi,
I am new to using Xceed and have spent most of the morning banging my head against a number of brick walls. I am trying to write some code that will allow me to zip/unzip a single file into/from an archive. I know that this should be very simple but I just can't get it to work properly regardless of how I try and do it. So far I have tried the following to get the file C:\file.txt zipped into an archive called c:\archive.zip. Any help ar advice would be greatly appreciated!
Thanks,
Ian
1) QuickZip
Code:
QuickZip.Zip(@"C:\archive.zip", @"C:\file.txt");
Problem:
This appears to be blocked by the corporate anti-virus software as I think it
is trying to write into a temporary folder and doesn't have the correct
permissions.
Error:
System.UnauthorizedAccessException was unhandled
Message="Access to the path 'C:\\Documents and Settings\\All Users\\Application Data\\Symantec\\SRTSP\\SrtETmp' is denied."
Source="Xceed.FileSystem"
StackTrace:
at Xceed.FileSystem.AbstractFolder.CopyFilesTo(FileSystemEvents events, Object userData, AbstractFolder destinationFolder, Boolean recursive, Boolean replaceExistingFiles, Object[] filters)
at Xceed.FileSystem.AbstractFolder.CopyFilesTo(AbstractFolder destinationFolder, Boolean recursive, Boolean replaceExistingFiles, Object[] filters)
at Xceed.Zip.QuickZip.Zip(String zipFileName, String encryptionPassword, Boolean replaceExistingFiles, Boolean recursive, Boolean preservePaths, String[] filesToZip)
at Xceed.Zip.QuickZip.Zip(String zipFileName, String[] filesToZip) ...
2) From Martin Plante's blog
Took code from here but no archive was created at all: http://blogs.xceedsoft.com/plantem/PermaLink.aspx?guid=7b3858fb-3d0f-43d8-8beb-7252943d68f1
My code:
AbstractFile zipFile = new DiskFile(@"C:\archive.zip");
AbstractFile textFile = new ZippedFile(zipFile, @"C:\file.txt");
3) From another online example:
ZipEvents ze = new ZipEvents();
DiskFile sourceFile = new DiskFile(@"C:\archive.zip");
sourceFile.Create(ze, @"C:\file.txt");
- creates an archive but there's nothing in it
: