.NET?? RAR ???? ??

Contents
[ Hide Show ]

??

Aspose.ZIP API? ???? ?? ?? ?????? ??? ???????? ????? ??? ? ????.� Aspose.ZIP API? RAR ???? ??? ?? RarArchive ???? ?????.��API? RAR ???? ?? ?? ??? ???? RarArchiveEntry ???? ?????.

RAR ???? ??? ??????.

?? ??

?? ?? ????? RarArchive ????? ???? ??? ???? ??? ?????.

??: C#? ?? RAR ?????? ?? ??

  1. RarArchive ????? ???? RAR ????? ???.
  2. ??? ??? ?? ? ?? ???? ?????.
  3. ? ?? ???? Open ???? ???? ?? ??? ?????.
  4. ??? ???? ???? ???? ?? ?? ???? ??? ??? ?? ?? ???? ???.
 1    using (RarArchive archive = new RarArchive("archive.rar"))
 2    {
 3        using (var destination = File.Create(dataDir + "firstEntry.txt"))
 4        {
 5                using (var source = archive.Entries[0].Open())
 6                {
 7                    byte[] buffer = new byte[1024];
 8                    int bytesRead;
 9                    while ((bytesRead = source.Read(buffer, 0, buffer.Length)) > 0)                       
10                        destination.Write(buffer, 0, bytesRead);
11                            
12                }                    
13        }
14    }

???? ?? ??

?? ?? ????? RarArchive ????? ???? ???? ??? ???? ??? ?????.

??: ?? C#? ?? RAR ????? ???? ??

  1. FileInfo ??? ???? ???? RAR ????? ????.
  2. ??? ??? ?? ?? ???? ?????.
  3. ? ?? ???? Extract ???? ???? ?? ???? ? ??? ????? ??????.
  4. ??? ???? ?? ??? ???.
1    FileInfo fi = new FileInfo("encrypted.rar");
2    using (RarArchive archive = new RarArchive(fi.OpenRead()))
3    {
4        using (var destination = File.Create(dataDir + "firstEntry.txt"))
5        {
6            archive.Entries[0].Extract(destination, "p@s$w0rd");                
7        }
8    }

??? ???? ?? ?

?? ?? ????? RarArchive ????? ?? ??? ???? ??? ?????.

??: C#? ?? ?? ????(RAR ????)

  1. RarArchive ????? ???? RAR ????? ???.
  2. ExtractToDirectory ???? ???? ????? ?? ??? ??? ????? ?????.
1    using (RarArchive archive = new RarArchive("archive.rar"))
2    {
3        archive.ExtractToDirectory("extracted");
4    }
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.