????? ZIP ? UnZIP ? .NET

API Aspose.ZIP ???????? ???????? ?? ????????????? ?????, ?? ?????????? ??? ?????? ??????? ?????????. ? ??? ?????? ???????? ?????? ?? ?? ?????????? ??????, ??? ? ??????? ??????.

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

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

?????: ???????? ????? ???????? ? ZIP-????? ?? ????????? C#

  1. ???????? ???????, ???? ??????? ?????, ??? ???????? ????????.
  2. ????????? ??? ?????? ?????? ??? ???????? ?????? ZIP ?? ????????? FileMode.Create.
  3. ???????? ????????? ????? ?????.
  4. ?? ????????? ?????? CreateEntries ??????? ?? ?????? ??? ????? ?? ????? ? ????????? ????????.
  5. ????????? ????? ?????????? ???????? ? ???????? ZIP-?????? ?? ????????? ?????? ??????????.
 1    // For complete examples and data files, please go to https://github.com/aspose-zip/Aspose.ZIP-for-.NET
 2    string dataDir = RunExamples.GetDataDir_Data();
 3
 4    using (FileStream zipFile = File.Open(dataDir + "CompressDirectory_out.zip", FileMode.Create))
 5    {
 6        using (FileStream zipFile2 = File.Open(dataDir + "CompressDirectory2_out.zip", FileMode.Create))
 7        {
 8            using (Archive archive = new Archive())
 9            {
10                DirectoryInfo corpus = new DirectoryInfo(dataDir + "CanterburyCorpus");
11                archive.CreateEntries(corpus);
12                archive.Save(zipFile);
13                archive.Save(zipFile2);
14            }
15        }
16    }

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

?????: ?????????? ????? ?????????? ????????

  1. ????????? ????? ????? ZIP ?? ????????? FileMode.Open.
  2. ???????? ????????? ????? Archive, ????????? ????? ????? ZIP.
  3. ?????????? ????? ?????????? ?????? ?? ????????? ???????? ?? ????????? ExtractToDirectory.
1    // For complete examples and data files, please go to https://github.com/aspose-zip/Aspose.ZIP-for-.NET
2    using (FileStream zipFile = File.Open(dataDir + "CompressDirectory_out.zip", FileMode.Open))
3    {
4        using (var archive = new Archive(zipFile))
5        {
6            archive.ExtractToDirectory(dataDir + "DecompressFolder_out");
7        }
8    }

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

?????: ????????? ????? ?? ??????????? ??? ????

  1. ????????? ????? ?????? ??? ????????? ZIP-????? ?? ????????? FileMode.Create.
  2. ???????? ??�???? FileInfo ??? ??????, ??? ???????? ????????.
  3. ???????? ????????? ????? ?????.
  4. ?????????????? ????? CreateEntry, ??? ?????? ????? ???? ?? ??????.
  5. ????????? ????? ?? ????????? ?????? ?????????? ? ??????????? ??????????? ??????????, ?????? ?? ???????????? ?????????.
 1    // For complete examples and data files, please go to https://github.com/aspose-zip/Aspose.ZIP-for-.NET
 2    using (FileStream zipFile = File.Open(dataDir + "CompressFilesByFileInfo_out.zip", FileMode.Create))
 3    {
 4        FileInfo fi1 = new FileInfo(dataDir + "alice29.txt");
 5        FileInfo fi2 = new FileInfo(dataDir + "fields.c");
 6
 7        using (var archive = new Archive())
 8        {
 9            archive.CreateEntry("alice29.txt", fi1);
10            archive.CreateEntry("fields.c", fi2);
11            archive.Save(zipFile, new ArchiveSaveOptions() { Encoding = Encoding.ASCII });
12        }
13    }

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

?????: ????????? ?????? ? ????? ??????? ??????

  1. ????????? ????? ????? ZIP ?? ????????? FileMode.Open.
  2. ???????? ????????? ????? Archive, ????????? ????? ????? ZIP.
  3. ?????????? ?????? ????? ? ??????, ???????? ??? ????? ?????? ??????????? ?????? ?? ????????? ?????? Extract.
  4. ????????? ?????? ????? ?? ????? ???????, ???????? ???? ? ???????? ????????? ?????.
1    // For complete examples and data files, please go to https://github.com/aspose-zip/Aspose.ZIP-for-.NET
2    using (FileStream zipFile = File.Open(dataDir + "\\different_password.zip", FileMode.Open))
3    {
4        using (Archive archive = new Archive(zipFile))
5        {
6            archive.Entries[0].Extract(dataDir + "alice29_extracted_pass_out.txt", "first_pass");
7            archive.Entries[1].Extract(dataDir + "asyoulik_extracted_pass_out.txt", "second_pass");
8        }
9    }
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.