1- using System . Diagnostics ;
2- using System . Text . RegularExpressions ;
1+ using System . Text . RegularExpressions ;
32using System . Xml ;
43
54namespace G2WwiseDataTool
65{
76 public class SoundbanksInfoParser
87 {
9- public static void ReadSoundbankInfo ( string inputPath , string outputPath , bool outputToFolderStructure , bool saveEventAndSoundBankPaths , bool verbose , IEnumerable < string > filterSoundBanks )
8+ public static void ReadSoundbankInfo ( string inputPath , string outputPath , bool saveEventAndSoundBankPaths , bool verbose , IEnumerable < string > filterSoundBanks )
109 {
1110
1211 string directoryPath = Path . GetDirectoryName ( inputPath ) ;
@@ -195,48 +194,20 @@ public static void ReadSoundbankInfo(string inputPath, string outputPath, bool o
195194 wwemMetaData . hashSizeInMemory = 4294967295 ;
196195 wwemMetaData . hashSizeInVideoMemory = 4294967295 ;
197196
198- if ( outputToFolderStructure )
199- {
200- string finalOutputPath = Path . Combine ( outputPath , wwev . eventObjectPath . TrimStart ( '\\ ' ) . Replace ( "\\ " , "/" ) ) ;
201- wwev . outputPath = finalOutputPath + ".wwiseevent" ;
202-
203- EventWriter . WriteWWEV ( ref wwev ) ;
204197
205- MetaFiles . GenerateMeta ( ref wwevMetaData , finalOutputPath + ".wwiseevent.meta.json" ) ;
198+ wwev . outputPath = outputPath + wwev . eventNameHash + ".WWEV" ;
206199
207- foreach ( EventWriter . Event . Entry entry in wwev . entries )
208- {
209- string finalOutputPathWem = Path . Combine ( outputPath , "Originals/" , entry . wemPath ) ;
200+ EventWriter . WriteWWEV ( ref wwev ) ;
210201
211- if ( ! Directory . Exists ( finalOutputPathWem ) )
212- {
213- Directory . CreateDirectory ( Path . GetDirectoryName ( finalOutputPathWem ) ) ;
214- }
202+ MetaFiles . GenerateMeta ( ref wwevMetaData , outputPath + wwev . eventNameHash + ".WWEV.meta.json" ) ;
215203
216- if ( entry . isStreamed )
217- {
218- File . Copy ( directoryPath + "/" + entry . wemID + ".wem" , finalOutputPathWem + ".wem" , true ) ;
219- wwemMetaData . hashValue = entry . wemNameHash ;
220- MetaFiles . GenerateMeta ( ref wwemMetaData , finalOutputPathWem + ".wem.meta.json" ) ;
221- }
222- }
223- }
224- else
204+ foreach ( EventWriter . Event . Entry entry in wwev . entries )
225205 {
226- wwev . outputPath = outputPath + wwev . eventNameHash + ".WWEV" ;
227-
228- EventWriter . WriteWWEV ( ref wwev ) ;
229-
230- MetaFiles . GenerateMeta ( ref wwevMetaData , outputPath + wwev . eventNameHash + ".WWEV.meta.json" ) ;
231-
232- foreach ( EventWriter . Event . Entry entry in wwev . entries )
206+ if ( entry . isStreamed )
233207 {
234- if ( entry . isStreamed )
235- {
236- File . Copy ( Path . Combine ( directoryPath , entry . wemID + ".wem" ) , outputPath + entry . wemNameHash + ".WWEM" , true ) ;
237- wwemMetaData . hashValue = entry . wemNameHash ;
238- MetaFiles . GenerateMeta ( ref wwemMetaData , outputPath + entry . wemNameHash + ".WWEM.meta.json" ) ;
239- }
208+ File . Copy ( Path . Combine ( directoryPath , entry . wemID + ".wem" ) , outputPath + entry . wemNameHash + ".WWEM" , true ) ;
209+ wwemMetaData . hashValue = entry . wemNameHash ;
210+ MetaFiles . GenerateMeta ( ref wwemMetaData , outputPath + entry . wemNameHash + ".WWEM.meta.json" ) ;
240211 }
241212 }
242213 }
@@ -305,31 +276,14 @@ public static void ReadSoundbankInfo(string inputPath, string outputPath, bool o
305276 flag = "1F"
306277 } ) ;
307278
308- if ( outputToFolderStructure == true )
309- {
310- string finalOutputPath = Path . Combine ( outputPath , switchGroupObjectPath . TrimStart ( '\\ ' ) . Replace ( "\\ " , "/" ) ) ;
311- if ( ! Directory . Exists ( outputPath ) )
312- {
313- Directory . CreateDirectory ( Path . GetDirectoryName ( outputPath ) ) ;
314- }
315-
316- switchData . outputPath = finalOutputPath + ".wwiseswitchgroup" ;
317- AudioSwitchWriter . WriteAudioSwitch ( ref switchData ) ;
318-
319- MetaFiles . GenerateMeta ( ref switchBlueprintMetaData , finalOutputPath + ".wwiseswitchgroup.meta.json" ) ;
320- }
321- else
322- {
323- switchData . outputPath = outputPath + switchGroupAssemblyHash + ".WSWB" ;
324- AudioSwitchWriter . WriteAudioSwitch ( ref switchData ) ;
325-
326- MetaFiles . GenerateMeta ( ref switchTypeMetaData , outputPath + switchGroupTypeAssemblyHash + ".WSWT.meta.json" ) ;
327- MetaFiles . GenerateMeta ( ref switchBlueprintMetaData , outputPath + switchGroupAssemblyHash + ".WSWB.meta.json" ) ;
279+ switchData . outputPath = outputPath + switchGroupAssemblyHash + ".WSWB" ;
280+ AudioSwitchWriter . WriteAudioSwitch ( ref switchData ) ;
328281
329- // Create blank WSWT file
330- File . Create ( outputPath + switchGroupTypeAssemblyHash + ".WSWT" ) ;
331- }
282+ MetaFiles . GenerateMeta ( ref switchTypeMetaData , outputPath + switchGroupTypeAssemblyHash + ".WSWT.meta.json" ) ;
283+ MetaFiles . GenerateMeta ( ref switchBlueprintMetaData , outputPath + switchGroupAssemblyHash + ".WSWB.meta.json" ) ;
332284
285+ // Create blank WSWT file
286+ File . Create ( outputPath + switchGroupTypeAssemblyHash + ".WSWT" ) ;
333287 }
334288
335289 MetaFiles . MetaData wbnkMetaData = new MetaFiles . MetaData ( ) ;
@@ -349,22 +303,8 @@ public static void ReadSoundbankInfo(string inputPath, string outputPath, bool o
349303 flag = "1F"
350304 } ) ;
351305
352- if ( outputToFolderStructure == true )
353- {
354- string finalOutputPath = Path . Combine ( outputPath , soundBankObjectPath . TrimStart ( '\\ ' ) . Replace ( "\\ " , "/" ) ) ;
355- if ( ! Directory . Exists ( outputPath ) )
356- {
357- Directory . CreateDirectory ( Path . GetDirectoryName ( outputPath ) ) ;
358- }
359-
360- ProcessSoundbanks . ProcessSoundbank ( Path . Combine ( directoryPath , soundBankPath ) , finalOutputPath + ".wwisesoundbank" ) ;
361- MetaFiles . GenerateMeta ( ref wbnkMetaData , finalOutputPath + ".wwisesoundbank.meta.json" ) ;
362- }
363- else
364- {
365- ProcessSoundbanks . ProcessSoundbank ( Path . Combine ( directoryPath , soundBankPath ) , outputPath + soundBankHash + ".WBNK" ) ;
366- MetaFiles . GenerateMeta ( ref wbnkMetaData , outputPath + soundBankHash + ".WBNK.meta.json" ) ;
367- }
306+ ProcessSoundbanks . ProcessSoundbank ( Path . Combine ( directoryPath , soundBankPath ) , outputPath + soundBankHash + ".WBNK" ) ;
307+ MetaFiles . GenerateMeta ( ref wbnkMetaData , outputPath + soundBankHash + ".WBNK.meta.json" ) ;
368308 }
369309 }
370310
0 commit comments