@@ -175,32 +175,44 @@ public void OnFileDropped(DragEventArgs e)
175175
176176 private void DoLoadArchives ( string [ ] ? filesDropped )
177177 {
178- if ( ! Directory . Exists ( "temp" ) )
179- {
180- Directory . CreateDirectory ( "temp" ) ;
181- }
182-
183- string path = "temp/ZIP_COMBINE_" + DateTime . Now . ToString ( "yyyyMMddHHmm" ) ;
184-
185178 if ( filesDropped == null || filesDropped . Length < 1 )
186179 {
187180 return ;
188181 }
189182
190- try
183+ new Thread ( ( ) =>
191184 {
192- foreach ( string v in filesDropped )
185+ string path = "temp/ZIP_COMBINE_" + DateTime . Now . ToString ( "yyyyMMddHHmm" ) ;
186+
187+ try
193188 {
194- Logger . Log ( LogType . Info , LogCategory . Import , $ "Unzipping ' { v } '" ) ;
195- ZipFile . ExtractToDirectory ( v , path , true ) ;
196- }
189+ foreach ( string v in filesDropped )
190+ {
191+ Logger . Log ( LogType . Info , LogCategory . Import , $ "Decompressing ' { v } '" ) ;
197192
198- DoLoad ( [ path ] ) ;
199- }
200- catch ( Exception ex )
193+ if ( ! File . Exists ( v ) )
194+ {
195+ Logger . Log ( LogType . Error , LogCategory . Import , $ "File '{ v } ' does not exist.") ;
196+ throw new Exception ( $ "File '{ v } ' does not exist. Have you tried importing multiple folders?") ;
197+ }
198+
199+ LoadingText = "Decompressing " + v ;
200+
201+ ZipFile . ExtractToDirectory ( v , path , true ) ;
202+ }
203+
204+ DoLoad ( [ path ] ) ;
205+ }
206+ catch ( Exception ex )
207+ {
208+ LoadingText = string . Empty ;
209+ this . ShowPopup ( $ "Exception on combining archives: { ex . Message } ", MainWindow . Instance . LocalizationManager [ "error" ] ) ;
210+ }
211+ } )
201212 {
202- this . ShowPopup ( $ "Exception on combining archives: { ex . Message } ", MainWindow . Instance . LocalizationManager [ "error" ] ) ;
203- }
213+ IsBackground = true ,
214+ Name = "Background Decompressing Thread"
215+ } . Start ( ) ;
204216 }
205217
206218 private void DoLoad ( string [ ] ? filesDropped )
@@ -210,13 +222,20 @@ private void DoLoad(string[]? filesDropped)
210222 return ;
211223 }
212224
225+ // multi zip support
226+ if ( filesDropped . Length > 1 )
227+ {
228+ DoLoadArchives ( filesDropped ) ;
229+ return ;
230+ }
231+
232+ string gamePath = filesDropped [ 0 ] ;
233+
213234 _ripper . ResetData ( ) ;
214235 SelectedAsset ? . Dispose ( ) ;
215236 SelectedAsset = null ;
216237 _assetContainer = null ;
217238
218- string gamePath = filesDropped [ 0 ] ;
219-
220239 HasFile = true ;
221240 HasLoaded = false ;
222241 Dispatcher . UIThread . Post ( ( ) => AssetFiles . Clear ( ) , DispatcherPriority . Send ) ;
@@ -435,22 +454,6 @@ public async void ShowOpenFileDialog()
435454 }
436455 }
437456
438- //Called from UI
439- public async void ShowOpenFileDialogZipArchives ( )
440- {
441- FilePickerOpenOptions options = new ( ) { AllowMultiple = true } ;
442- IReadOnlyList < IStorageFile > fileList = await MainWindow . Instance . StorageProvider . OpenFilePickerAsync ( options ) ;
443-
444- string [ ] result = fileList . Select ( f => f . Path . LocalPath )
445- . Where ( s => ! string . IsNullOrEmpty ( s ) )
446- . ToArray ( ) ;
447-
448- if ( result . Length > 0 )
449- {
450- DoLoadArchives ( result ) ;
451- }
452- }
453-
454457 //Called from UI
455458 public async void ShowOpenFolderDialog ( )
456459 {
0 commit comments