?????? ??????? ???????
API Aspose.ZIP ????????? ??????? ? ????????????? ????? ?? C# ??? ????? ????? .NET, ?? ?????????? ? ??????? ???????? ?????????. ? ???? ?????? ????????? ??????? ?????????? ?????? ??????? ? ?????????????? ??? ???????????? ???? ??????????, ??? ? ???? ?????????? AES. ????? ????, ????????, ??? ???????? ? ?????????? ? ??????? ????????? ?????? ? ?????????????? ????????? ??????? ??????????.
?????? ??????? ? ???????????? ???????????
Aspose.ZIP ???????????? ???????????? ?????? ??????? ??? ?????? ??????. ????????? ??????? ??????, ?? ?????? ???????? ????????? ????? ??? ????? ???????? ? ??????, ??????????, ??? ?????? ?????????????? ???????????? ?????? ??????? ??????????.
?????????? ?????? ? ??????? ???????????? ????? ??????????
?????????? ?????, ????????? ????? ??????? ???????????? ????? ??????????. ???? ?????? ???????????? ??????? ?????? ??????? ???????, ??????????, ??? ????? ??????? ?????????, ????????? ??? ???? ?????????? ????????? ????????????? ??????????? ??????.
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 + "CompressWithTraditionalEncryption_out.zip", FileMode.Create))
3 {
4 using (FileStream source1 = File.Open(dataDir + "alice29.txt", FileMode.Open, FileAccess.Read))
5 {
6 var archive = new Archive(new ArchiveEntrySettings(null, new TraditionalEncryptionSettings("p@s$")));
7 archive.CreateEntry("alice29.txt", source1);
8 archive.Save(zipFile);
9 }
10 }?????????? ?????? ? ??????? ?????????? AES
Aspose.ZIP ??? .NET ????????????? ??????????? ??????????, ??????? ??????? ??? ???????? ???????????????? ????? ? ???????. API ???????????? ?????????? AES, ????????? ????????? ???????? ?????? (128-???, 192-??? ? 256-???) ??? ????????? ??????? ????????????. ? ??????? ???? ??????? ?????????? ?? ?????? ???? ???????, ??? ???? ?????? ?????? ???????? ? ???????? ?????? ?????????????? ?????????????.
?????????? ?????? ? ??????? AES128
Aspose.ZIP ??? .NET ????????????? ??????????? ??????????, ??????? ??????? ??? ???????? ???????????????? ????? ? ???????. API ???????????? ?????????? AES, ????????? ????????? ???????? ?????? (128-???, 192-??? ? 256-???) ??? ????????? ??????? ????????????. ? ??????? ???? ??????? ?????????? ?? ?????? ???? ???????, ??? ???? ?????? ?????? ???????? ? ???????? ?????? ?????????????? ?????????????. ??? ?????? ????, ??? ??? ????????.
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 + "PasswordProtectWithAES128_out.zip", FileMode.Create))
3 {
4 using (FileStream source1 = File.Open(dataDir + "alice29.txt", FileMode.Open, FileAccess.Read))
5 {
6 using (var archive = new Archive(new ArchiveEntrySettings(null, new AesEcryptionSettings("p@s$", EncryptionMethod.AES128))))
7 {
8 archive.CreateEntry("alice29.txt", source1);
9 archive.Save(zipFile);
10 }
11 }
12 }?????????? ?????? ? ??????? AES192
?????????? AES192 ???????????? ????? ??????? ??????? ???????????? ?? ????????? ? AES128, ?? ? ??????? ???????????? ????????? ?? ??????????. ???? ????? ???????? ??? ?????????, ??? ????????? ????? ???????? ?????? ??? ??????? ???????? ?????? ??? ??????????????????. ?????????? ????????? ??????, ????? ?????? ??? ?????????????.
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 + "PasswordProtectWithAES192_out.zip", FileMode.Create))
3 {
4 using (FileStream source1 = File.Open(dataDir + "alice29.txt", FileMode.Open, FileAccess.Read))
5 {
6 using (var archive = new Archive(new ArchiveEntrySettings(null, new AesEcryptionSettings("p@s$", EncryptionMethod.AES192))))
7 {
8 archive.CreateEntry("alice29.txt", source1);
9 archive.Save(zipFile);
10 }
11 }
12 }?????????? ?????? ? ??????? AES256
AES256 � ????? ???????? ??????? ??????????, ????????? ? ????????? AES, ?????????????? ???????????? ????????????. ?? ???????? ???????? ??? ?????? ????? ???????????????? ??????, ??? ????????? ???????????? ????????????, ???? ???? ??? ?????????? ? ???????????? ????????? ?????? ?????????????? ????????. ??. ?????? ????.
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 + "PasswordProtectWithAES256_out.zip", FileMode.Create))
3 {
4 using (FileStream source1 = File.Open(dataDir + "alice29.txt", FileMode.Open, FileAccess.Read))
5 {
6 using (var archive = new Archive(new ArchiveEntrySettings(null, new AesEcryptionSettings("p@s$", EncryptionMethod.AES256))))
7 {
8 archive.CreateEntry("alice29.txt", source1);
9 archive.Save(zipFile);
10 }
11 }
12 }???????, ?????????? ???????
?????? ?????????? ????????? ??????, Aspose.ZIP ????????? ???????? ??????? ????? ????????. ??? ???????? ???????, ????? ??? ????? ??????????? ????????? ?????? ????????????, ??????? ??? ?????????? ???????? ????? ???????.
1// ?????? ??????? ? ????? ?????? ????? ????? ?? ?????? https://github.com/aspose-zip/Aspose.ZIP-for-.NET.
2????????? (FileStream zipFile = File.Open(".\\all_corpus_encrypted_out.zip", FileMode.Create))
3{
4 DirectoryInfo corpus = ????? DirectoryInfo(".\\CanterburyCorpus");
5 ????????? (var archive = ????? Archive(new ArchiveEntrySettings(null, new TraditionalEncryptionSettings("p@s$"))))
6 {
7 archive.CreateEntries(??????);
8 ?????.?????????(zipFile);
9 }
10} **?????????? ?????????? ?????? ? ??????? ????????? ??????? ??????????**API ????? ???????????? ????????????? ????????? ??????? ?????????? ? ????? ??????. ??? ????????? ????????? ????????? ?????????? ??????????, ????? ??? AES ? ???????????? ?????? ???????, ? ????????? ?????? ? ??????????? ?? ?? ?????????????????? ? ?????????? ????????????. ????? ???????? ???????????? ????? ????????? ???????? ??? ??????? ?????? ? ??????. ????????? ?? ???? ??????, ????? ???????, ??? ??? ???????? ?? ????????.
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 + "CompressWithTraditionalEncryption_out.zip", FileMode.Create))
3 {
4 using (FileStream source1 = File.Open(dataDir + "alice29.txt", FileMode.Open, FileAccess.Read))
5 {
6 var archive = new Archive(new ArchiveEntrySettings(null, new TraditionalEncryptionSettings("p@s$")));
7 archive.CreateEntry("alice29.txt", source1);
8 archive.Save(zipFile);
9 }
10 }?????????? ??????, ?????????? ???????
????? ?????????? ??????? ??? ????? ?????????? ?????, ??? ???????????? ? ??????? ????? ??? ?????????????. Aspose.ZIP ???????? ?????????? ???????, ?????????? ???????, ?????????? ?? ????, ?????????????? ?? ???????????? ?????????? ??? AES. ?? ?????? ????????? ????? ?? ??????????? ??? ????????????? ???? ????????????? ???????.
?????????? ???????, ??????????? ?????????? ???????
????? ?????????? ?????, ?????????? ???????????? ???????. ???? ????? ???????????? ??????, ?????????? ? ?????????????? ?????? ??????? ??????????, ??????????? ?????? ? ????? ?????? ????? ?????????????? ??????????? ??????.
1 // For complete examples and data files, please go to https://github.com/aspose-zip/Aspose.ZIP-for-.NET
2 using (FileStream fs = File.OpenRead(dataDir + "CompressWithTraditionalEncryption_out.zip"))
3 {
4 using (var extracted = File.Create(dataDir + "alice_extracted_out.txt"))
5 {
6 using (Archive archive = new Archive(fs, new ArchiveLoadOptions() { DecryptionPassword = "p@s$" }))
7 {
8 using (var decompressed = archive.Entries[0].Open())
9 {
10 byte[] b = new byte[8192];
11 int bytesRead;
12 while (0 < (bytesRead = decompressed.Read(b, 0, b.Length)))
13 {
14 extracted.Write(b, 0, bytesRead);
15 }
16 }
17 }
18 }
19 }?????????? ???????, ????????????? AES
? ???? ??????? ??????????????, ??? ??????? ?????, ????????????? ? ??????? AES, ?????? ?? ???????? ?????????? ?????????? ??????????. ?????????? ?? ????, ?????? ?? ?? ???? ? AES128, AES192 ??? AES256, ??????? ?????????? ?????, ???? ???????????? ?????????? ???? ????????????.
1 // For complete examples and data files, please go to https://github.com/aspose-zip/Aspose.ZIP-for-.NET
2 using (FileStream fs = File.OpenRead(dataDir + "PasswordProtectWithAES256_out.zip"))
3 {
4 using (var extracted = File.Create(dataDir + "alice_aesextracted_out.txt"))
5 {
6 using (Archive archive = new Archive(fs))
7 {
8 using (var decompressed = archive.Entries[0].Open("p@s$"))
9 {
10 byte[] b = new byte[8192];
11 int bytesRead;
12 while (0 < (bytesRead = decompressed.Read(b, 0, b.Length)))
13 {
14 extracted.Write(b, 0, bytesRead);
15 }
16 }
17 }
18 }
19 }?????????? ???????????? ??????, ?????????????? AES
?????????? ????? ?? ?????????????? ?????? ? ??????? ??? ??? ??????. ???? ??????? ???????????, ??? ???? ???????? ????? ????????? ? ????????????, ??????? ???????????????? ?????? ? ???????? ??? ???? ???????? ???????? ?????????.
1 // For complete examples and data files, please go to https://github.com/aspose-zip/Aspose.ZIP-for-.NET
2 using (FileStream fs = File.OpenRead(dataDir + "StoreMutlipleFilesWithoutCompressionWithPassword_out.zip"))
3 {
4 using (var extracted = File.Create(dataDir + "alice_aesextracted_out.txt"))
5 {
6 using (Archive archive = new Archive(fs, new ArchiveLoadOptions() { DecryptionPassword = "p@s$" }))
7 {
8 using (var decompressed = archive.Entries[0].Open())
9 {
10 byte[] b = new byte[8192];
11 int bytesRead;
12 while (0 < (bytesRead = decompressed.Read(b, 0, b.Length)))
13 {
14 extracted.Write(b, 0, bytesRead);
15 }
16 }
17 }
18 }
19 }??????????? ????????????? ????? ? ???????
????????? ????? ????????????? ???????? ??????? ? ???????? ????????? ?????. ???? ??????? ??????????????? ??? ????? ?? ?????????????? ?????? ? ????????? ???????, ???????? ??? ???? ?? ???????? ???????? ? ????????????, ??? ???????, ??? ???????????? ?????????? ???? ????????????.
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(".\\all_corpus_encrypted.zip", FileMode.Open))
3 {
4 new Archive(zipFile, new ArchiveLoadOptions() { DecryptionPassword = "p@s$" }).ExtractToDirectory(".\\all_corpus_decrypted");
5 }?????????? ???????
Aspose.ZIP ??? .NET ?????????? ??????? ? ????????????? API ??? ?????????? ???????, ?????????? ?? ????, ???????? ?? ??? ???? ????, ????????? ?????? ??? ???? ??????????? ????? ??? ??????. ? ???? ??????? ??????????????? ????????? ???????? ?????????? ? ???????????? ??????????? ??????? ??? ?????????? ?????? ??????.
?????????? ??????, ?????????? ?? ?????? ?????
? ?????????, ????? ????? ???????? ?????? ???? ????, ?????????? ??????????? ??????. ?? ?????? ?????? ? ? ???????????? ????????? ??????? ?????????? ??????, ?????????? ??????????? ???????? ??????, ????????? ????????? ??????:
1 // For complete examples and data files, please go to https://github.com/aspose-zip/Aspose.ZIP-for-.NET
2 using (FileStream fs = File.OpenRead(dataDir + "CompressSingleFile_out.zip"))
3 {
4 using (Archive archive = new Archive(fs))
5 {
6 int percentReady = 0;
7 archive.Entries[0].ExtractionProgressed += (s, e) =>
8 {
9 int percent = (int)((100 * e.ProceededBytes) / ((ArchiveEntry)s).UncompressedSize);
10 if (percent > percentReady)
11 {
12 Console.WriteLine(string.Format("{0}% decompressed", percent));
13 percentReady = percent;
14 }
15 };
16 archive.Entries[0].Extract(dataDir + "alice_extracted_out.txt");
17 }
18 }??????????? ?????, ?????????? ????????? ??????
??? ?????? ? ????????, ??????????? ????????? ??????, ??? API ???????? ??????? ???????? ??????? ? ?? ???????????? ??????????. ???????????? ???? ??????? ?? ?????? ??????? ?? ????? ?????????? ???????? ??????? ??? ??????????? ??????? ????? ?? ????????????.
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 + "CompressMultipleFiles_out.zip", FileMode.Open))
3 {
4 StringBuilder sb = new StringBuilder("Entries are: ");
5 int percentReady = 0;
6 using (Archive archive = new Archive(zipFile,
7 new ArchiveLoadOptions()
8 {
9 EntryListed = (s, e) => { sb.AppendFormat("{0}, ", e.Entry.Name); },
10 EntryExtractionProgressed = (s, e) =>
11 {
12 int percent = (int)((100 * e.ProceededBytes) / ((ArchiveEntry)s).UncompressedSize);
13 if (percent > percentReady)
14 {
15 Console.WriteLine(string.Format("{0}% compressed", percent)); percentReady = percent;
16 }
17 }
18 }))
19 {
20 Console.WriteLine(sb.ToString(0, sb.Length - 2));
21 using (var extracted = File.Create(dataDir + "alice_extracted_out.txt"))
22 {
23 using (var decompressed = archive.Entries[0].Open())
24 {
25 byte[] buffer = new byte[8192];
26 int bytesRead;
27 while (0 < (bytesRead = decompressed.Read(buffer, 0, buffer.Length)))
28 {
29 extracted.Write(buffer, 0, bytesRead);
30 }
31 // Read from decompressed stream to extracting file.
32 }
33 }
34 percentReady = 0;
35 archive.Entries[1].Extract(dataDir + "asyoulik_extracted_out.txt");
36 }
37 }?????????? ???????????? ?????? ??? ??????
??????????? ??????, ?????????? ???????? ?????, ????? ?????????????? API Aspose.Zip. ???? ??? ?????? ?? ????????? ?????? ?????, ??? ???????????? ??????? ?????? ? ??????????? ?????????? ?????????? ??????. ??? ???????, ????? ??? ????? ????????? ????? ??????, ?? ????? ?? ?????????.
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 + "StoreMultipleFilesWithoutCompression_out.zip", FileMode.Open))
3 {
4 using (Archive archive = new Archive(zipFile))
5 {
6 using (var extracted = File.Create(dataDir + "alice_extracted_store_out.txt"))
7 {
8 using (var decompressed = archive.Entries[0].Open())
9 {
10 byte[] buffer = new byte[8192];
11 int bytesRead;
12 while (0 < (bytesRead = decompressed.Read(buffer, 0, buffer.Length)))
13 {
14 extracted.Write(buffer, 0, bytesRead);
15 }
16 // Read from decompressed stream to extracting file.
17 }
18 }
19
20 using (var extracted = File.Create(dataDir + "asyoulik_extracted_store_out.txt"))
21 {
22 using (var decompressed = archive.Entries[1].Open())
23 {
24 byte[] buffer = new byte[8192];
25 int bytesRead;
26 while (0 < (bytesRead = decompressed.Read(buffer, 0, buffer.Length)))
27 {
28 extracted.Write(buffer, 0, bytesRead);
29 }
30 // Read from decompressed stream to extracting file.
31 }
32 }
33 }
34 }