?????????????? ZIP ? tar.gz ????? C#

Contents
[ Hide Show ]

Tar.gz � ??????????, ????? ???????????????? ?????? ?????? ??????? ? ???? Linux, ? ZIP � ????? ?????????? ??? Windows. ???? ?? ?????? ?????????????? ZIP-????? ? tar.gz, ???????? ??? ??????.

?????????

Aspose.ZIP API ????????????? ????? SaveGzipped ??? ?????? tar-?????? ?? ????. ?? ????? ??????? ?????? ?? ZIP-?????? ? ??????, ?? ???????? ?? ? ????????????? ?????????, ? ????? ???????? ? tar-?????.

?????????, ??? ? ??? ?????????? ??????????? ?????? ??? ???????? ??????????? ???? ???????.

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

? ????????? ??????? ???? ????????, ??? ??????? ?????? ?? ZIP-?????? ? ????? ?? ????????? ?? ? ????? tar.gz. ??????, ?????????? ??????????, ????????????, ?? ?? ????? ??????????? ? ??????????? ????????????? ?????.

 1    using (Archive source = new Archive("source.zip"))
 2    {
 3        using (TarArchive tar = new TarArchive())
 4        {
 5            foreach (ArchiveEntry entry in source.Entries)
 6            {
 7                if (!entry.IsDirectory)
 8                {
 9                    MemoryStream mem = new MemoryStream();
10                    entry.Open().CopyTo(mem);                
11                    tar.CreateEntry(entry.Name, mem);
12                }
13            }
14
15            tar.SaveGzipped("result.tar.gz");
16        }
17    }
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.