???????????? RAR ?? ZIP ?? ????????? C#

Contents
[ Hide Show ]

???? ?? ?????? ???????????? ????? RAR ? ZIP, ?????????? ?? ??????.

???????????

Aspose.ZIP API ?????�???? RarArchive�??? ??????????? ??????? RAR.�?? ?????? ??????? ????? ? ???’???, ?? ?????????? ???? ? ?????????? ???????, ? ??????? ???????? ? ZIP-?????.

?????????????, ?? ? ??? ????????? ??????????? ???�???, ??? ???????? ????? ???? ???????.

????????? ?????

? ?????????? ????? ???????? ???? ????????, ?? ??????? ?????? ? ?????? RAR ? ??????? ????????? ???? ? ????? ZIP. ??????, ??? ? ??????????, ????????? ? ??????? ??????, ??? ????????? ?? ???.

 1    using (Archive zip = new Archive())
 2    {
 3        using (RarArchive rar = new RarArchive(@"D:\archvie.rar"))
 4        {
 5            for (int i = 0; i < rar.Entries.Count; i++)
 6            {                        
 7                if (!rar.Entries[i].IsDirectory)
 8                {
 9                    var ms = new MemoryStream();
10                    rar.Entries[i].Extract(ms);
11                    ms.Seek(0, SeekOrigin.Begin);
12                    zip.CreateEntry(rar.Entries[i].Name, ms);
13                }
14                else
15                    zip.CreateEntry(rar.Entries[i].Name + "/", Stream.Null);
16            }
17        }
18
19        zip.Save("output.zip");
20    }
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.