@@ -8,8 +8,8 @@ namespace Xamarin.Android.Tasks
88 public class ZipArchiveEx : IDisposable
99 {
1010
11- public static int ZipFlushSizeLimit = 100 * 1024 * 1024 ;
12- public static int ZipFlushFilesLimit = 512 ;
11+ const int DEFAULT_FLUSH_SIZE_LIMIT = 100 * 1024 * 1024 ;
12+ const int DEFAULT_FLUSH_FILES_LIMIT = 512 ;
1313
1414 ZipArchive zip ;
1515 string archive ;
@@ -24,6 +24,9 @@ public ZipArchive Archive {
2424
2525 public bool CreateDirectoriesInZip { get ; set ; } = true ;
2626
27+ public int ZipFlushSizeLimit { get ; set ; } = DEFAULT_FLUSH_SIZE_LIMIT ;
28+ public int ZipFlushFilesLimit { get ; set ; } = DEFAULT_FLUSH_FILES_LIMIT ;
29+
2730 public ZipArchiveEx ( string archive ) : this ( archive , FileMode . CreateNew )
2831 {
2932 }
@@ -65,7 +68,7 @@ void AddFileAndFlush (string filename, long fileLength, string archiveFileName,
6568 {
6669 filesWrittenTotalSize += fileLength ;
6770 zip . AddFile ( filename , archiveFileName , compressionMethod : compressionMethod ) ;
68- if ( ( filesWrittenTotalSize >= ZipArchiveEx . ZipFlushSizeLimit || filesWrittenTotalCount >= ZipArchiveEx . ZipFlushFilesLimit ) && AutoFlush ) {
71+ if ( ( filesWrittenTotalSize >= ZipFlushSizeLimit || filesWrittenTotalCount >= ZipFlushFilesLimit ) && AutoFlush ) {
6972 Flush ( ) ;
7073 }
7174 }
@@ -80,7 +83,7 @@ public void AddEntryAndFlush (byte[] data, string archiveFileName)
8083 {
8184 filesWrittenTotalSize += data . Length ;
8285 zip . AddEntry ( data , archiveFileName ) ;
83- if ( ( filesWrittenTotalSize >= ZipArchiveEx . ZipFlushSizeLimit || filesWrittenTotalCount >= ZipArchiveEx . ZipFlushFilesLimit ) && AutoFlush ) {
86+ if ( ( filesWrittenTotalSize >= ZipFlushSizeLimit || filesWrittenTotalCount >= ZipFlushFilesLimit ) && AutoFlush ) {
8487 Flush ( ) ;
8588 }
8689 }
@@ -89,7 +92,7 @@ public void AddEntryAndFlush (string archiveFileName, Stream data, CompressionMe
8992 {
9093 filesWrittenTotalSize += data . Length ;
9194 zip . AddEntry ( archiveFileName , data , method ) ;
92- if ( ( filesWrittenTotalSize >= ZipArchiveEx . ZipFlushSizeLimit || filesWrittenTotalCount >= ZipArchiveEx . ZipFlushFilesLimit ) && AutoFlush ) {
95+ if ( ( filesWrittenTotalSize >= ZipFlushSizeLimit || filesWrittenTotalCount >= ZipFlushFilesLimit ) && AutoFlush ) {
9396 Flush ( ) ;
9497 }
9598 }
0 commit comments