From e9d5464c7beb32ca84565e908e9bb40be3ae02d2 Mon Sep 17 00:00:00 2001 From: louis Date: Fri, 6 Mar 2020 21:59:43 -0500 Subject: [PATCH] acb_extract: parallelize --- acb_extract/.gitignore | 2 ++ acb_extract/src/CriUtfTable.cs | 2 +- acb_extract/src/Program.cs | 9 +++++---- 3 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 acb_extract/.gitignore diff --git a/acb_extract/.gitignore b/acb_extract/.gitignore new file mode 100644 index 0000000..cd42ee3 --- /dev/null +++ b/acb_extract/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/ diff --git a/acb_extract/src/CriUtfTable.cs b/acb_extract/src/CriUtfTable.cs index 84e8f7d..4e46698 100644 --- a/acb_extract/src/CriUtfTable.cs +++ b/acb_extract/src/CriUtfTable.cs @@ -467,7 +467,7 @@ namespace vgm_acb.extract 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) { diff --git a/acb_extract/src/Program.cs b/acb_extract/src/Program.cs index ace98b3..dde0cb0 100644 --- a/acb_extract/src/Program.cs +++ b/acb_extract/src/Program.cs @@ -1,17 +1,18 @@ using System; using System.IO; +using System.Threading.Tasks; namespace vgm_acb.extract { static class extract { 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)) { - CriAcbFile acb = new CriAcbFile(fs, 0, false); - acb.ExtractAll(); + CriAcbFile acb = new CriAcbFile(fs, 0, false); + acb.ExtractAll(); } - } + }); } } }