From 4d3be901886f566c32cf222f23e3dc5f413afe69 Mon Sep 17 00:00:00 2001 From: ManlyMarco <39247311+ManlyMarco@users.noreply.github.com> Date: Tue, 27 Sep 2022 20:23:58 +0200 Subject: [PATCH] Output separate asset zips for human and machine translations --- tools/ReleaseTool/ReleaseTool/Program.cs | 26 +++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/tools/ReleaseTool/ReleaseTool/Program.cs b/tools/ReleaseTool/ReleaseTool/Program.cs index 23658256d4..cfa388f73b 100644 --- a/tools/ReleaseTool/ReleaseTool/Program.cs +++ b/tools/ReleaseTool/ReleaseTool/Program.cs @@ -156,14 +156,14 @@ void AddToZip(string filePath, string entryName) } var assetDir = Path.Combine(tlDir, "RedirectedResources\\assets"); - if (Directory.Exists(assetDir) && Directory.GetFiles(assetDir, "*.txt", SearchOption.AllDirectories).Any()) + if (Directory.Exists(assetDir) && Directory.GetFiles(assetDir, "translation.txt", SearchOption.AllDirectories).Any()) { var assZipPath = GetTempFileName(); using (var assZipFile = ZipFile.Create(assZipPath)) { assZipFile.BeginUpdate(new MemoryArchiveStorage(FileUpdateMode.Direct)); - foreach (var file in Directory.GetFiles(assetDir, "*.txt", SearchOption.AllDirectories)) + foreach (var file in Directory.GetFiles(assetDir, "translation.txt", SearchOption.AllDirectories)) { var entryName = CleanPath(file.Substring(assetDir.Length)); //Console.WriteLine("Adding to redirected assets archive: " + entryName); @@ -172,7 +172,27 @@ void AddToZip(string filePath, string entryName) assZipFile.CommitUpdate(); } - AddToZip(assZipPath, "BepInEx\\Translation\\en\\RedirectedResources\\assets\\" + translationName + "_Assets.zip"); + AddToZip(assZipPath, "BepInEx\\Translation\\en\\RedirectedResources\\assets\\" + "01_" + translationName + "_Translations.zip"); + } + + assetDir = Path.Combine(tlDir, "RedirectedResources\\assets"); + if (Directory.Exists(assetDir) && Directory.GetFiles(assetDir, "zz_machineTranslation.txt", SearchOption.AllDirectories).Any()) + { + var assZipPath = GetTempFileName(); + using (var assZipFile = ZipFile.Create(assZipPath)) + { + assZipFile.BeginUpdate(new MemoryArchiveStorage(FileUpdateMode.Direct)); + + foreach (var file in Directory.GetFiles(assetDir, "zz_machineTranslation.txt", SearchOption.AllDirectories)) + { + var entryName = CleanPath(file.Substring(assetDir.Length)); + //Console.WriteLine("Adding to redirected assets archive: " + entryName); + assZipFile.Add(file, entryName); + } + + assZipFile.CommitUpdate(); + } + AddToZip(assZipPath, "BepInEx\\Translation\\en\\RedirectedResources\\assets\\" + "09_" + translationName + "_MachineTranslations.zip"); } var textDir = Path.Combine(tlDir, "Text");