Quantcast
Channel: sharpcompress Discussions Rss Feed
Viewing all 239 articles
Browse latest View live

New Post: Monitoring zip progress with delegates?


New Post: Monitoring zip progress with delegates?

$
0
0
Cool thanks guys. What about when creating a zip? I have a lot of large files I need to zip, so being able to get feed back on that would be amazing.

New Post: Monitoring zip progress with delegates?

$
0
0
Sorry, don't have that in. Though it ought to be :)

Could you make an issue on the GitHub site? Thanks.

New Post: Monitoring zip progress with delegates?

New Post: Left date (creation, read, edit) unchanged after file is added to archive

$
0
0
I successfully create my zip archive but, I don't want that editing date of file added in this zip archive is automatically altered. In the worst case I would set editing date to a given date.
How can avoid this behaviour? This is my code:
        private String CreaPacchettoZip(String idProcesso, String pdfBasePath, String primoPdfPacchetto, String ultimoPdfPacchetto)
        {
            List<String> listaPdfDiProcesso = FileHelper.EstraiListaPdfDaDirecotry(pdfBasePath, primoPdfPacchetto, ultimoPdfPacchetto);
            String zipFile = Path.Combine(pdfBasePath, idProcesso + ".zip");

            using (var archive = ZipArchive.Create())
            {
                
                foreach (String file in listaPdfDiProcesso)
                {
                    archive.AddEntry(file, new FileInfo(pdfBasePath, file));
                }

               using (Stream newStream = File.Create(zipFile))
                {
                    archive.SaveTo(newStream, SharpCompress.Common.CompressionType.None);
                }
            }

            return zipFile;
        }

New Post: Rar Files

$
0
0
First is how do you code for Rar files? Next I was using Ionic.Zip.dll but had issues with reading rar files.

Line of coding I used for my program was this:

using (ZipFile zip = ZipFile.Read(armaPath + file))
{
foreach (ZipEntry zipFiles in zip)
{
      zipFiles.Extract(armaPath, ExtractExistingFileAction.OverwriteSilently);
}
}


How would I do this using SharpCompress?

New Post: Rar Files

New Post: How to OpenRead in WP 8.1

$
0
0
Dim fs As System.IO.Stream = ???OpenRead???("MyFolder/MyBuildActionContentFile.zip")
Dim archive = SharpCompress.Archive.ArchiveFactory.Open(fs)
For i As Integer = 0 To archive.Entries.Count - 1
   If Not archive.Entries(i).IsDirectory Then
       If archive.Entries(i).Key.Contains("TheFileImLookingFor.txt") Then
           Dim zipStream As System.IO.Stream = archive.Entries(i).OpenEntryStream
           Dim myStreamReader As New IO.StreamReader(zipStream)
           Return myStreamReader.ReadToEnd()
           Exit For
        End If
    End If
Next

New Post: How to OpenRead in WP 8.1

$
0
0
Windows Phone 8.0
Dim fs As IO.FileStream = IO.File.OpenRead(MyFolder/MyFile.txt)
Windwos Phone 8.1 WinRT
Dim fs As System.IO.Stream = Await Windows.ApplicationModel.Package.Current.InstalledLocation.OpenStreamForReadAsync("MyFolder\MyFile.txt")
Apparently in 8.0 one had to use forward slashes "/" and now in 8.1 one must use backslashes "\"; Who would have thought?

New Post: Windows Phone 8.1 extraction

$
0
0
Hello there!

I am developing an app that targets Windows Phone 8.1 and my backend constructs a password-protected .zip file.

This file is being downloaded by my app in order to feed it with data for offline use.
System.IO.Compression does not provide support for password-protected archives. As a result, I tried to find other libraries. I downloaded and referenced SharpCompress. Unfortunelly, I haven't had any chance making it extract my archive.

All I am trying to do is extract an archive's content, but with no luck. And I cannot find any appropriate examples. If it helps you, it contains a folder and within the folder there is one password-protected file.

Can anyone provide some help? Thank you in advance :)

New Post: Reading GZIP file 'on the fly'

$
0
0
Lets say I'm making an HttpWebRequest for a gzip file out on a remote server. How do I stream that through SharpCompress so that I can write the content to disk (or to some other output stream)?

I tried a simple test like this:
       GZipStream gzs = new GZipStream(myHttpStream, CompressionMode.Decompress);

        byte[] buffer = new byte[1024];
        int read;
        while ((read = gzs.Read(buffer, 0, buffer.Length)) > 0) {
            myWriter.Write(buffer, 0, read);
        }
        myWriter.Flush();

        gzs.Close();
It reads just the first row of the file and that's it. What am I doing wrong here? I'd really like to be able to stream it through this code without having to physically download the file first. Thanks

New Post: Read Archive Comment

$
0
0
Ahoy, i did some research regarding this topic before, but got no helpfull information,
as i know, i can read the "per entry comments" in a zip file by using something like this:
string filename="C:\\path\\to\\archive.zip";
ZipArchive archive = (ZipArchive)ArchiveFactory.Open(filename);
foreach(ZipArchiveEntry entry in archive.Entries){
    Console.WriteLine("{0}: {1}",entry.FilePath,entry.Comment);
}
But until now i didn't find a way to get the "archive comment" of C:\path\to\archive.zip (or some actual existing zip file...).
So my question is: Is it possible to read the "archive comment" using SharpCompress and if yes how? Or if not, does someone here know another way?

T.i.A.

New Post: Read Archive Comment

$
0
0
Looks like this is something I haven't currently implemented. You can put an issue on the github site or better yet, fork the repo and fix it then submit a pull request :)

Thanks.

New Post: ArchiveFactory.Open() don't work on Windows Univerval App

$
0
0
So, here is a very simple code :
IRandomAccessStreamWithContentType stream = await file.OpenReadAsync();
IArchive archive = ArchiveFactory.Open(stream.AsStreamForRead());
This should work fine, but archive is not properly loaded. Instead, if I use the following snippet, all works fine :
IRandomAccessStreamWithContentType stream = await file.OpenReadAsync();
IArchive archive = SharpCompress.Archive.Zip.ZipArchive.Open(stream.AsStreamForRead());
To test this, I used a very basic ZIP file create with 7Zip.

New Post: 7z timestamp metadata

$
0
0
Hi,

currently time-stamp metadata is not accessible for 7z archives. When trying to get an entries last access, last modified or created times, the property accessor throws a NotImplementedException. Are there any plans to support this? This component works great for my usage so far, but for my usage the time-stamps are critical.

Thanks!

New Post: Inspection of a rar multipart archive

$
0
0
Hello Adam,

as far as I can see, 7-zip and WinRar are able to retrieve information about the whole archive by inspecting only a single part of a multipart archive.
These information contain data like the total number of parts, compression rate, total size packed, total size unpacked.
My intension is to check a directory for completeness of the containing .rar files thus to find out if there are any files missiing.
Is this possible with your work? After a thoroughly search I could not find any clues to this, I always end up by getting an error like e.g. 'SharpCompress.Common.IncompleteArchiveException'

kind regards and thank you for your work,
quad

New Post: Windows Phone 7.8: MissingMethodException when calling MoveToNextEntry()

$
0
0
I'm trying to use SharpCompress in Visual Studio 2010 Express for Windows Phone 7. Here's my simple code:
IsolatedStorageFileStream inputFile;
RarReader reader;

inputFile = IsolatedStorageFile.GetUserStoreForApplication().OpenFile("myfile.rar", FileMode.Open);



reader = RarReader.Open(inputFile);
reader.MoveToNextEntry();  // This raises an exception

inputFile.Close();
But when running this code I'm getting:
Method not found: lag rlib, Version=3.7.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC.System.Enum.
at
reader.MoveToNextEntry();
Using this code:
IReader reader;
reader = ReaderFactory.Open(inputFile);
I'm also getting:
Could not load type 'System.Func`2' from assembly 'mscorlib, Version=3.7.0.0, Culture=neutral, PublicKeyToken=969DB8053D3322AC'.
Any ideas?

Thanks in advance.

New Post: Increase File Extraction Speed VB.net

$
0
0
Hi All
I would like to know if there is a way for me to increase the speed of the decompressor on sharpcompress I have looked through the forums and can't find what I'm looking for I'm using Visual Basic.net and here is the code I am using to extract the files it uses the Background Worker tool

Code:
        BackgroundWorker1.ReportProgress(0)
        System.Threading.Thread.Sleep(1)

        'Extract Archive In The Background So Application Wont Freeze
        Dim archive As IArchive = ArchiveFactory.Open(OFD.FileName)
        For Each entry In archive.Entries

            If Not entry.IsDirectory Then
                Console.WriteLine(entry.FilePath)
                entry.WriteToDirectory(My.Application.Info.DirectoryPath & "\Mods\", ExtractOptions.ExtractFullPath Or ExtractOptions.Overwrite)

            End If
        Next
        If My.Computer.FileSystem.DirectoryExists(My.Application.Info.DirectoryPath & "\Mods\" & My.Settings.NewModName) Then
            Message = MsgBox(My.Settings.NewModName & " Already Exsists Do You Want To Overight The Directory? Selecting No Will Terminate Mod Extraction", MsgBoxStyle.YesNo, "Mod Already Exsists")
            If Message = MsgBoxResult.No Then
                My.Computer.FileSystem.DeleteDirectory(My.Application.Info.DirectoryPath & "\Mods\" & My.Settings.Orignal_Name, FileIO.DeleteDirectoryOption.DeleteAllContents, FileIO.RecycleOption.DeletePermanently)
            Else
                My.Computer.FileSystem.DeleteDirectory(My.Application.Info.DirectoryPath & "\Mods\" & My.Settings.NewModName, FileIO.DeleteDirectoryOption.DeleteAllContents, FileIO.RecycleOption.DeletePermanently)
                My.Computer.FileSystem.RenameDirectory(My.Application.Info.DirectoryPath & "\Mods\" & My.Settings.Orignal_Name, My.Settings.NewModName)

            End If

        End If
        My.Computer.FileSystem.RenameDirectory(My.Application.Info.DirectoryPath & "\Mods\" & My.Settings.Orignal_Name, My.Settings.NewModName)
If anyone can help me speed up the decompressor I would be very happy given me a headache trying to work this one out. :)

New Post: Reading files in order including sub directories

$
0
0
I'm trying to read archives in order that can be in the following format:

-File1
-File2
-File3

or

-SubDirectory
--File1
--File2
--File3

Using the method in the documentation works and includes sub folders but seems to read files in a random order:
var reader = ReaderFactory.Open(stream);
    while (reader.MoveToNextEntry())javascript:void(0);
Using the second method in the documentation doesn't include the sub folders but reads in the correct file order:
var archive = ArchiveFactory.Open(@"C:\Code\sharpcompress\TestArchives\sharpcompress.zip");
foreach (var entry in archive.Entries)
Is there a best of both worlds solution possible here where I can read the exact first file including sub directories? At the moment I'm having to use the first method and use a set of regular expressions to determine if it is in fact the file I am looking for which can be very slow and error prone.

New Post: Working example code für Windwos Store 8.x?

$
0
0
I can't find anywhere working examplecode for Windows store applications, running Windows 8.1. Does somewhere an example exists (which also supports unzipping large zip files with many nested subdirectories and Passwort protected zips?)?

Thanks in advance,
Andy
Viewing all 239 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>