@@ -129,6 +129,36 @@ async Task<bool> DecompressAsyncWithSevenZip(string archiveFilePath, string dest
129
129
fsProgress . TotalSize = zipFile . ArchiveFileData . Select ( x => ( long ) x . Size ) . Sum ( ) ;
130
130
fsProgress . Report ( ) ;
131
131
132
+ zipFile . Extracting += ( s , e ) =>
133
+ {
134
+ if ( fsProgress . TotalSize > 0 )
135
+ fsProgress . Report ( e . BytesProcessed / ( double ) fsProgress . TotalSize * 100 ) ;
136
+ } ;
137
+
138
+ zipFile . FileExtractionStarted += ( s , e ) =>
139
+ {
140
+ if ( statusCard . CancellationToken . IsCancellationRequested )
141
+ e . Cancel = true ;
142
+
143
+ if ( ! e . FileInfo . IsDirectory )
144
+ {
145
+ ThreadingService . ExecuteOnUiThreadAsync ( ( ) =>
146
+ {
147
+ fsProgress . FileName = e . FileInfo . FileName ;
148
+ fsProgress . Report ( ) ;
149
+ } ) ;
150
+ }
151
+ } ;
152
+
153
+ zipFile . FileExtractionFinished += ( s , e ) =>
154
+ {
155
+ if ( ! e . FileInfo . IsDirectory )
156
+ {
157
+ fsProgress . AddProcessedItemsCount ( 1 ) ;
158
+ fsProgress . Report ( ) ;
159
+ }
160
+ } ;
161
+
132
162
bool isSuccess = false ;
133
163
134
164
try
@@ -168,35 +198,6 @@ async Task<bool> DecompressAsyncWithSevenZip(string archiveFilePath, string dest
168
198
}
169
199
}
170
200
171
- zipFile . Extracting += ( s , e ) =>
172
- {
173
- if ( fsProgress . TotalSize > 0 )
174
- fsProgress . Report ( e . BytesProcessed / ( double ) fsProgress . TotalSize * 100 ) ;
175
- } ;
176
-
177
- zipFile . FileExtractionStarted += ( s , e ) =>
178
- {
179
- if ( statusCard . CancellationToken . IsCancellationRequested )
180
- e . Cancel = true ;
181
-
182
- if ( ! e . FileInfo . IsDirectory )
183
- {
184
- ThreadingService . ExecuteOnUiThreadAsync ( ( ) =>
185
- {
186
- fsProgress . FileName = e . FileInfo . FileName ;
187
- fsProgress . Report ( ) ;
188
- } ) ;
189
- }
190
- } ;
191
-
192
- zipFile . FileExtractionFinished += ( s , e ) =>
193
- {
194
- if ( ! e . FileInfo . IsDirectory )
195
- {
196
- fsProgress . AddProcessedItemsCount ( 1 ) ;
197
- fsProgress . Report ( ) ;
198
- }
199
- } ;
200
201
return isSuccess ;
201
202
}
202
203
0 commit comments