From 68fd8fcfc5efd4cafb4a883be803b62ede0a5bb2 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Sun, 26 Jan 2025 17:03:49 -0600 Subject: [PATCH] feat: exergize globs --- package.json | 3 ++- src/CLI/CLI.csproj | 4 ++++ src/CLI/Functions/Unpacker.cs | 13 ++++++++++--- src/CLI/Program.cs | 6 ++++++ 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index afe16a2e7..0b4bffd7c 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,8 @@ "build:reviews": "cd packages/scripts && bun build:reviews", "build:ids": "cd packages/scripts && bun build:ids", "prunestrings": "cd packages/scripts && bun prunestrings", - "dev:cli:unpack": "cd src/CLI && dotnet run unpack \"C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest\"" + "dev:cli:unpack": "cd src/CLI && dotnet run unpack \"C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest\"", + "dev:cli:test": "cd src/CLI && dotnet run test" }, "license": "MIT", "dependencies": { diff --git a/src/CLI/CLI.csproj b/src/CLI/CLI.csproj index 56a41df47..567edb11d 100644 --- a/src/CLI/CLI.csproj +++ b/src/CLI/CLI.csproj @@ -9,4 +9,8 @@ + + + + diff --git a/src/CLI/Functions/Unpacker.cs b/src/CLI/Functions/Unpacker.cs index aeb5a6111..2001bd6ad 100644 --- a/src/CLI/Functions/Unpacker.cs +++ b/src/CLI/Functions/Unpacker.cs @@ -4,6 +4,7 @@ using CLI.Utils; using CUE4Parse.FileProvider.Objects; using CUE4Parse.UE4.Pak; using CUE4Parse.UE4.Readers; +using DotNet.Globbing; namespace CLI.Functions { @@ -185,12 +186,18 @@ namespace CLI.Functions } } - private static string[] ExergizableFiles = ["Blitz/Config/DefaultDlc.ini"]; + private static readonly string[] ExergizableGlobsRaw = + [ + "Blitz/Config/DefaultDlc.ini", + "Blitz/Content/Tanks/**", + "Blitz/Content/TankSets/*", + ]; + private static readonly Glob[] ExergizableGlobs = [.. ExergizableGlobsRaw.Select(Glob.Parse)]; private static bool ShouldExergize(string path) { - return true; - // return ExergizableFiles.Contains(path); + // return true; + return ExergizableGlobs.Any(glob => glob.IsMatch(path)); } } } diff --git a/src/CLI/Program.cs b/src/CLI/Program.cs index 59ab12a15..8c0101cdf 100644 --- a/src/CLI/Program.cs +++ b/src/CLI/Program.cs @@ -14,6 +14,12 @@ namespace CLI break; } + case "test": + { + Test.Run(args); + break; + } + default: { throw new ArgumentException("Invalid command");