acb_extract: parallelize

This commit is contained in:
louis 2020-03-06 21:59:43 -05:00
parent 87e3398067
commit e9d5464c7b
3 changed files with 8 additions and 5 deletions

2
acb_extract/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
bin/
obj/

View file

@ -467,7 +467,7 @@ namespace vgm_acb.extract
int tableSize = (int)this.UtfReader.ReadUint(fs, offsetToUtfTable, 4) + 8; int tableSize = (int)this.UtfReader.ReadUint(fs, offsetToUtfTable, 4) + 8;
pathToUtf = Path.Combine(Path.GetTempPath(), TEMP_UTF_TABLE_FILE); pathToUtf = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid()}_{TEMP_UTF_TABLE_FILE}");
if (this.IsEncrypted) if (this.IsEncrypted)
{ {

View file

@ -1,17 +1,18 @@
using System; using System;
using System.IO; using System.IO;
using System.Threading.Tasks;
namespace vgm_acb.extract namespace vgm_acb.extract
{ {
static class extract static class extract
{ {
static void Main(string[] args) { static void Main(string[] args) {
foreach (string s in args) { Parallel.ForEach(args, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount }, (s) => {
using (FileStream fs = File.Open(s, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (FileStream fs = File.Open(s, FileMode.Open, FileAccess.Read, FileShare.Read)) {
CriAcbFile acb = new CriAcbFile(fs, 0, false); CriAcbFile acb = new CriAcbFile(fs, 0, false);
acb.ExtractAll(); acb.ExtractAll();
} }
} });
} }
} }
} }