???????? ???????? ZIP-??????
????? ????????? ???, ??? ?? ???????? ???????? ???????? zip-?????? ?? ?????? ????????. ??? ?????? ????? ?????? ??????? ????? ???????, ??? ??? ????????????? ?? ????? ????????? ??????.
?????
?????????? ????? EventsBag, ??????? ???????? ??????????? ??? ???????, ????????? ? ???????. ?????? ?? ???????????? ???? ??????? � EntryCompressed. ?? ????????? ????? ?????? ?????? ?????? ? ????? ???? ???????.
?????? ???????? ???????? ??????
????????, ?? ??????, ????? ??? ZIP-????? ??? ????????? ???????? ?? ??????. ????? ???? ??? ?????-?? ?????? ???? ?????, ????????? ?????, ????????? ? ?????? ??????, ? ???? ??? ?????? ?????? ??????, ???????? ???????. ? ?????? ??????????? ??? ???? ?? ????? ??????, ??????? ??, ??????? ??????? ???????.
????: ?????? ???????? ??????? ??????? ? C#</ ???????>
- ??????????????? ????? ?????? �?????� ??? ????????? ??????.
- ????????? ??????????, ????? ??????????? ????????????????? ???????? ??????.
- ???????? ?????? ?????? ?? ???????? ? ??????? ?????? CreateEntries, ?????? ????? ??? ??????.
- ????????? EventsBag ??? ????????? ??????? ??????.
- ?????????? ?????????? ??????? EntryCompressed, ??????? ?????????, ????????? ?? ????????? ????? ???? ??????, ? ??? ????????????? ???????? ????????.
- ????????? ?????????? ? ??????????? ? ?????????? ??????, ???????
EventsBag?ArchiveSaveOptions.
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#
- ??????????????? ????? ?????? �?????� ??? ????????? ??????.
- ??????????? ????? CreateEntries ??? ?????????? ?????? ?? ?????????? ????????.
- ????????? EventsBag ??? ?????????? ????????? ??????.
- ?????????? ?????????? ??????? EntryCompressed, ??????? ?????????, ????????????? ?? ????????? ?????? ????????????? ????? ????? (????????, �last.bin�).
- ???? ??????? ?????? ???????, ??????????? ??????.
- ????????? ????? ? �EventsBag�, ?????????? ? �ArchiveSaveOptions�.
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 }