Batch compile / decompile
dsuurlant opened this issue · 3 comments
dsuurlant commented
Not all templates are mapped yet, but lots are, and a batch functionality would be really helpful at this point. Being able to grep all the XML will make it easier for modders to find what they need. I'd like to take a crack at it myself.
hhrhhr commented
something like this one-line command?
for /r "...\NMS_unpacked_dir\" %i in ("*.MBIN") do @MBINCompiler.exe "%i"
for /r "...\NMS_unpacked_dir\" %i in ("*.exml") do @MBINCompiler.exe "%i"
Bananasft commented
something like this one-line command?
Pretty much this, you are also able to pass an output path as second argument.
Meaning you could do something like this:
$inPath = "C:\NMS\unpacked";
$outPath = "C:\NMS\unpacked_exml";
$mbinCompiler = "C:\NMS\tools\MBINCompiler.exe";
Get-ChildItem $inPath -Filter *.mbin -Recurse | % {
$outDir = $_.Directory.FullName.Replace($inPath, $outPath);
if(!(Test-Path $outDir))
{
New-Item $outDir -ItemType Directory | Out-Null
}
$mbinFile = "`"$($_.FullName)`" ";
$exmlFile = "`"$outDir\$($_.Name.Replace(".MBIN",".exml"))`"";
& $mbinCompiler $mbinFile $exmlFile
}
(This can also be found here.)
A few more lines but it recursively decompiles every mbin in one folder into another.
dsuurlant commented
I was thinking inside the application code, but that works too, thanks!