????? ZIP ? UnZIP ? .NET
Contents
[
Hide
Show
]API Aspose.ZIP ???????? ???????? ?? ????????????? ?????, ?? ?????????? ??? ?????? ??????? ?????????. ? ??? ?????? ???????? ?????? ?? ?? ?????????? ??????, ??? ? ??????? ??????.
????????? ????????
????????? ?????? ????????
?????: ???????? ????? ???????? ? ZIP-????? ?? ????????? C#
- ???????? ???????, ???? ??????? ?????, ??? ???????? ????????.
- ????????? ??? ?????? ?????? ??? ???????? ?????? ZIP ?? ????????? FileMode.Create.
- ???????? ????????? ????? ?????.
- ?? ????????? ?????? CreateEntries ??????? ?? ?????? ??? ????? ?? ????? ? ????????? ????????.
- ????????? ????? ?????????? ???????? ? ???????? 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 }??????????? ?????? ?????????? ????????
?????: ?????????? ????? ?????????? ????????
- ????????? ????? ????? ZIP ?? ????????? FileMode.Open.
- ???????? ????????? ????? Archive, ????????? ????? ????? ZIP.
- ?????????? ????? ?????????? ?????? ?? ????????? ???????? ?? ????????? 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 }????????? ?????? ?? ??????????? ??? ????
?????: ????????? ????? ?? ??????????? ??? ????
- ????????? ????? ?????? ??? ????????? ZIP-????? ?? ????????? FileMode.Create.
- ???????? ??�???? FileInfo ??? ??????, ??? ???????? ????????.
- ???????? ????????? ????? ?????.
- ?????????????? ????? CreateEntry, ??? ?????? ????? ???? ?? ??????.
- ????????? ????? ?? ????????? ?????? ?????????? ? ??????????? ??????????? ??????????, ?????? ?? ???????????? ?????????.
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 }???????? ?????? ? ??????? ???????? ???????
?????: ????????? ?????? ? ????? ??????? ??????
- ????????? ????? ????? ZIP ?? ????????? FileMode.Open.
- ???????? ????????? ????? Archive, ????????? ????? ????? ZIP.
- ?????????? ?????? ????? ? ??????, ???????? ??? ????? ?????? ??????????? ?????? ?? ????????? ?????? Extract.
- ????????? ?????? ????? ?? ????? ???????, ???????? ???? ? ???????? ????????? ?????.
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 }