Skip to content

Commit a66c7fe

Browse files
committed
refactor!: remove structured folder output mode
1 parent 4cc2ddd commit a66c7fe

4 files changed

Lines changed: 21 additions & 85 deletions

File tree

G2WwiseDataTool/MD5.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Security.Cryptography;
2-
using System.Text;
1+
using System.Text;
32

43
namespace G2WwiseDataTool
54
{

G2WwiseDataTool/Options.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@ public class Options
1010
[Option('o', "output", SetName = "export", Required = false, HelpText = "Path to output files (Defaults to current working directory).")]
1111
public string outputPath { get; set; } = Directory.GetCurrentDirectory();
1212

13-
[Option('f', "output-folder-structure", SetName = "export", Required = false, HelpText = "Output to a folder structure instead of hashes.")]
14-
public bool outputToFolderStructure { get; set; }
15-
1613
[Option('s', "save-paths", SetName = "export", Required = false, HelpText = "Save Event and SoundBank paths to a events.txt and soundbanks.txt file in the output path.")]
1714
public bool saveEventAndSoundBankPaths { get; set; }
1815

19-
[Option("filter", SetName = "export", Required = false, HelpText = "Filters which SoundBanks will get exported separated by spaces. Example: --filter Example_SoundBank MyAwesomeSoundBank (case sensitive).")]
16+
[Option('f', "filter", SetName = "export", Required = false, HelpText = "Filters which SoundBanks will get exported separated by spaces. Example: --filter Example_SoundBank MyAwesomeSoundBank (case sensitive).")]
2017
public IEnumerable<string> filterSoundBanks { get; set; }
2118

2219
[Option('v', "verbose", SetName = "export", Required = false, HelpText = "Set output to verbose messages.")]

G2WwiseDataTool/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static void Main(string[] args)
2222
}
2323
else
2424
{
25-
SoundbanksInfoParser.ReadSoundbankInfo(options.inputPath, Path.TrimEndingDirectorySeparator(options.outputPath) + "/", options.outputToFolderStructure, options.saveEventAndSoundBankPaths, options.verbose, options.filterSoundBanks);
25+
SoundbanksInfoParser.ReadSoundbankInfo(options.inputPath, Path.TrimEndingDirectorySeparator(options.outputPath) + "/", options.saveEventAndSoundBankPaths, options.verbose, options.filterSoundBanks);
2626
}
2727
}
2828

G2WwiseDataTool/SoundbanksInfoParser.cs

Lines changed: 18 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
using System.Diagnostics;
2-
using System.Text.RegularExpressions;
1+
using System.Text.RegularExpressions;
32
using System.Xml;
43

54
namespace 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

Comments
 (0)