.NET?? RAR ???? ??
Contents
[
Hide
Show
]??
Aspose.ZIP API? ???? ?? ?? ?????? ??? ???????? ????? ??? ? ????.� Aspose.ZIP API? RAR ???? ??? ?? RarArchive ???? ?????.��API? RAR ???? ?? ?? ??? ???? RarArchiveEntry ???? ?????.
RAR ???? ??? ??????.
?? ??
?? ?? ????? RarArchive ????? ???? ??? ???? ??? ?????.
- RarArchive ????? ???? RAR ????? ???.
- ??? ??? ?? ? ?? ???? ?????.
- ? ?? ???? Open ???? ???? ?? ??? ?????.
- ??? ???? ???? ???? ?? ?? ???? ??? ??? ?? ?? ???? ???.
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 ????? ???? ??
- FileInfo ??? ???? ???? RAR ????? ????.
- ??? ??? ?? ?? ???? ?????.
- ? ?? ???? Extract ???? ???? ?? ???? ? ??? ????? ??????.
- ??? ???? ?? ??? ???.
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 ????? ?? ??? ???? ??? ?????.
- RarArchive ????? ???? RAR ????? ???.
- ExtractToDirectory ???? ???? ????? ?? ??? ??? ????? ?????.
1 using (RarArchive archive = new RarArchive("archive.rar"))
2 {
3 archive.ExtractToDirectory("extracted");
4 }