?? ?? ?? ??

Contents
[ Hide Show ]

?? ??? ???

?? ??? ??? ? ?? ?? ????? ?? ??? ?? ? ????. zip ????? ?? ?? ???? CompressionProgressed ???? ????. ? ???? ???? ??? ??? ?? ???? ProgressEventArgs? ?????. ??? ?? ??? ???? ? ???? ??? ? ?? ?????.

1   Entry.CompressionProgressed += (s, e) => { 
2      Console.WriteLine(string.Format("{0}??? ???", e.ProceededBytes)); 
3   };

Zip ??? ??

‘CompressionProgressed’ ???? ??? ??? ‘ProceededBytes’ ??? ?? ??? ??? ????. ?? ?? ?? ??? ???? ??? ? ? ????. ??? ?? ?????.

??: C#?? Zip ??? ??

  1. File.Open? ???? ?? ???? huge.bin ??? ?? ??? ?????.
  2. ??? ?? PPMdCompressionSettings? ???? Archive ???? ? ????? ??????.
  3. CreateEntry ???? ???? huge.bin ??? ?? ???? ??? ???? ?? ?? ?? ???? ?????.
  4. CompressionProgressed ???? ??? ???? ???? ?? ?? ??? ???????. ???? ??? ??? ??? ?????.
  5. ??? ??? ??? ?? ??? ?????? ???? ??? ??? ??? ?????.
  6. ??? ???? ??? zipFile? ????? ?????.
 1   (FileStream ?? = File.Open("huge.bin", FileMode.Open, FileAccess.Read)) ??
 2   {
 3      (var archive = new Archive(new ArchiveEntrySettings(new PPMdCompressionSettings()))) ??
 4      {
 5         ArchiveEntry ?? = archive.CreateEntry("huge.bin", source);
 6         int ??? ?? = 0;
 7         Entry.CompressionProgressed += (s, e) =>
 8               {
 9                  int ??? = (int)((100 * (long)e.ProceededBytes) / source.Length);
10                  if (??? > ?????)                 
11                  {
12                        Console.WriteLine(string.Format("{0}% ???", ???));
13                        ????? = ???;
14                  }       
15               };
16         archive.Save(zip??);
17      }
18   }

7z ??? ??

7z ?????? ??? ?? ??? ????. ?? ???? ?? CompressionProgressed ???? ????.

??: C#? 7z ?????? LZMA2? ???? ?? ?? ?? ????</ ?>

  1. ?? ??(huge.bin)? ?? ??? ???.
  2. LZMA2 ?? ??? ???? SevenZipArchive ??? ????.
  3. CreateEntry ???? ???? ?? ??? ????? ???? ?????.
  4. CompressionProgressed ???? ???? ?? ???? ???? ?????.
  5. ?? ?? ?? ????? ?? ??? ?? ??? ?????.
  6. ????? ??? ??(zipFile)? ?????.
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.