@@ -163,12 +163,20 @@ private static BdatTables ReadBdatTables(Options options, bool readMetadata)
163
163
{
164
164
if ( options . Game == Game . XB2 && options . ArdFilename != null )
165
165
{
166
- using ( var archive = new FileArchive ( options . ArhFilename , options . ArdFilename ) )
166
+ using ( var headerFile = new LocalFile ( options . ArhFilename , OpenMode . Read ) )
167
+ using ( var dataFile = new LocalFile ( options . ArdFilename , OpenMode . Read ) )
167
168
{
169
+ var archive = new ArchiveFileSystem ( headerFile , dataFile ) ;
168
170
return new BdatTables ( archive , readMetadata ) ;
169
171
}
170
172
}
171
173
174
+ if ( options . Game == Game . XB2 && options . SdPath != null )
175
+ {
176
+ var archive = new Xb2FileSystem ( options . SdPath ) ;
177
+ return new BdatTables ( archive , readMetadata ) ;
178
+ }
179
+
172
180
string pattern = options . Filter ?? "*" ;
173
181
string [ ] filenames = Directory . GetFiles ( options . BdatDir , pattern ) ;
174
182
return new BdatTables ( filenames , options . Game , readMetadata ) ;
@@ -189,7 +197,7 @@ public static BdatCollection GetBdatCollection(Options options)
189
197
return tables ;
190
198
}
191
199
192
- public static BdatCollection GetBdatCollection ( IFileReader fs , bool readMetadata )
200
+ public static BdatCollection GetBdatCollection ( IFileSystem fs , bool readMetadata )
193
201
{
194
202
var bdats = new BdatTables ( fs , readMetadata ) ;
195
203
BdatCollection tables = Deserialize . DeserializeTables ( bdats ) ;
@@ -353,19 +361,18 @@ private static void CombineBdat(Options options)
353
361
354
362
private static void ReadGimmick ( Options options )
355
363
{
356
- using ( var xb2Fs = new Xb2Fs ( options . Xb2Dir ) )
357
- {
358
- if ( options . Xb2Dir == null ) throw new NullReferenceException ( "Must specify XB2 Directory." ) ;
359
- if ( options . Output == null ) throw new NullReferenceException ( "No output path was specified." ) ;
360
- if ( ! Directory . Exists ( options . Xb2Dir ) ) throw new DirectoryNotFoundException ( $ "{ options . Xb2Dir } is not a valid directory.") ;
364
+ if ( options . SdPath == null ) throw new NullReferenceException ( "Must specify SD card path." ) ;
365
+ if ( options . Output == null ) throw new NullReferenceException ( "No output path was specified." ) ;
366
+ if ( ! Directory . Exists ( options . SdPath ) ) throw new DirectoryNotFoundException ( $ "{ options . SdPath } is not a valid directory.") ;
361
367
362
- BdatCollection tables = GetBdatCollection ( xb2Fs , false ) ;
368
+ var xb2Fs = new Xb2FileSystem ( options . SdPath ) ;
363
369
364
- MapInfo [ ] gimmicks = ReadGmk . ReadAll ( xb2Fs , tables ) ;
365
- ExportMap . ExportCsv ( gimmicks , options . Output ) ;
370
+ BdatCollection tables = GetBdatCollection ( xb2Fs , false ) ;
366
371
367
- ExportMap . Export ( xb2Fs , gimmicks , options . Output ) ;
368
- }
372
+ MapInfo [ ] gimmicks = ReadGmk . ReadAll ( xb2Fs , tables ) ;
373
+ ExportMap . ExportCsv ( gimmicks , options . Output ) ;
374
+
375
+ ExportMap . Export ( xb2Fs , gimmicks , options . Output ) ;
369
376
}
370
377
371
378
private static void ReadScript ( Options options )
@@ -421,15 +428,15 @@ private static void ExtractMinimap(Options options)
421
428
422
429
private static void GenerateSite ( Options options )
423
430
{
424
- if ( options . Xb2Dir == null ) throw new NullReferenceException ( "Must specify XB2 Directory ." ) ;
431
+ if ( options . SdPath == null ) throw new NullReferenceException ( "Must specify SD card path ." ) ;
425
432
if ( options . Output == null ) throw new NullReferenceException ( "No output path was specified." ) ;
426
433
if ( ! Directory . Exists ( options . Xb2Dir ) ) throw new DirectoryNotFoundException ( $ "{ options . Xb2Dir } is not a valid directory.") ;
427
434
428
435
options . Progress . LogMessage ( "Reading XB2 directories" ) ;
429
- using ( var xb2Fs = new Xb2Fs ( options . Xb2Dir ) )
430
- {
431
- Website . Generate . GenerateSite ( xb2Fs , options . Output , options . Progress ) ;
432
- }
436
+ var xb2Fs = new Xb2FileSystem ( options . SdPath ) ;
437
+
438
+ Website . Generate . GenerateSite ( xb2Fs , options . Output , options . Progress ) ;
439
+
433
440
}
434
441
435
442
private static void ExportQuests ( Options options )
0 commit comments