ZIP ???? ?? ??

Contents
[ Hide Show ]

??? ??? zip ???? ??? ???? ?? ?? ????. ??? ?? ?? ???? ??? ?? ??? ???? ?? ?? ????.

??

???? ?? ???? ????? EventsBag ???? ????. ?? ??? ???? EntryCompressed? ?????. ???? ??? ??? ? ???? ??? ?????.

? ???? ?? ?? ?

ZIP ????? ? 1? ?? ????? ???? ??? ?????. ?? ??? ??? ? ?? ???? ??? ??? ????, 1? ?? ???? ????? ??????. ?? ?????? ???? ???? ??? ???? ?? ??? ??? ?? ????.

??: C#?? ? ???? ??? ????? ???>

  1. ??? ???? ?? ??? ‘Archive’ ??? ??????.
  2. ?? ??? ?? ??? ???? ?? ????? ?????.
  3. ‘CreateEntries’ ???? ???? ?????? ???? ??? ???? ??? ??? ?????.
  4. ?? ???? ???? ?? ‘EventsBag’? ?????.
  5. ?? ??? 1?? ????? ???? ??? ?? ??? ???? ‘EntryCompressed’ ???? ?? ??? ???? ?????.
  6. ????? ???? ArchiveSaveOptions? EventsBag? ???? ???? ??? ?????.
 1    using (var archive = new Archive())
 2    {
 3        Stopwatch sw = new Stopwatch();
 4                                
 5        archive.CreateEntries(@"D:\BigFolder");
 6        EventsBag eb = new EventsBag();
 7        eb.EntryCompressed += delegate(object sender, CancelEntryEventArgs args)
 8            {
 9            if (sw.Elapsed > TimeSpan.FromSeconds(60))
10                args.Cancel = true;
11            };
12        sw.Start();
13        archive.Save("output.zip", new ArchiveSaveOptions() { EventsBag = eb });
14    }

?? ?? ? ??

?? ??? ??? ? ????? ?? ???? ?????.

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

  1. ??? ???? ?? ??? ‘Archive’ ??? ??????.
  2. ‘CreateEntries’ ???? ???? ??? ?????? ??? ?????.
  3. ?? ???? ????? ‘EventsBag’? ?????.
  4. ?? ?? ??? ?? ?? ??(?: “last.bin”)? ????? ???? ‘EntryCompressed’ ???? ?? ??? ???? ?????.
  5. ?? ??? ???? ??? ??????.
  6. ArchiveSaveOptions? ??? EventsBag? ???? ????? ?????.
 1    using (var archive = new Archive())
 2    {                          
 3        archive.CreateEntries(@"D:\BigFolder");
 4        EventsBag eb = new EventsBag();
 5        eb.EntryCompressed += delegate(object sender, CancelEntryEventArgs args)
 6            {
 7            if (args.Entry.Name == @"BigFolder\last.bin")
 8                args.Cancel = true;
 9            };      
10        archive.Save("output.zip", new ArchiveSaveOptions() { EventsBag = eb });
11    }
Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.