From b70d65f37ba51e06ab6944deeef09403d458778d Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Sat, 25 Jan 2025 21:42:25 -0600 Subject: [PATCH] feat: more --- .github/workflows/assets.yml | 30 ++++++++++++++++++++--- src/CLI/Functions/{DLC.cs => Unpacker.cs} | 25 +++++++++++++------ src/CLI/Models/Arguments.cs | 19 -------------- src/CLI/Program.cs | 12 +++++---- 4 files changed, 52 insertions(+), 34 deletions(-) rename src/CLI/Functions/{DLC.cs => Unpacker.cs} (50%) delete mode 100644 src/CLI/Models/Arguments.cs diff --git a/.github/workflows/assets.yml b/.github/workflows/assets.yml index fa9def43e..6dc498ed7 100644 --- a/.github/workflows/assets.yml +++ b/.github/workflows/assets.yml @@ -21,11 +21,18 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 with: submodules: recursive token: ${{ secrets.GH_TOKEN }} + - name: Setup .NET + uses: actions/setup-dotnet@v4 + + - name: Restore + run: dotnet restore + - name: Setup DepotDownloader run: | mkdir -p temp @@ -43,7 +50,7 @@ jobs: echo "Download complete; files:" ls temp/depotDownloader - - name: (Steam) Download client + - name: Download client run: | chmod +x temp/depotDownloader/DepotDownloader temp/depotDownloader/DepotDownloader \ @@ -52,4 +59,21 @@ jobs: -os ${{ env.STEAM_OS }} \ -app ${{ env.STEAM_APP }} \ -depot ${{ env.STEAM_DEPOT }} \ - -filelist regex:.+/Blitz/Content/Paks/.+\.pak + -dir temp/depots + + - name: Unpack + run: | + cd temp/depots/${{ env.STEAM_APP }} + + SUBDIR_COUNT=$(ls | wc -l) + if [ "$SUBDIR_COUNT" -ne 1 ]; then + echo "Error: Expected exactly 1 subdirectory, found $SUBDIR_COUNT" + exit 1 + fi + + DEPOT_BRANCH_BUILD_ID=$(ls) + echo "Found build ID: $DEPOT_BRANCH_BUILD_ID" + + cd ../../../src/CLI + + dotnet run unpack ../../temp/depots/${{ env.STEAM_APP }}/$DEPOT_BRANCH_BUILD_ID/ diff --git a/src/CLI/Functions/DLC.cs b/src/CLI/Functions/Unpacker.cs similarity index 50% rename from src/CLI/Functions/DLC.cs rename to src/CLI/Functions/Unpacker.cs index a971552c9..aa4c4753d 100644 --- a/src/CLI/Functions/DLC.cs +++ b/src/CLI/Functions/Unpacker.cs @@ -1,15 +1,26 @@ -using CLI.Models; -using CLI.Utils; - namespace CLI.Functions { - class DLC + class Unpacker { - public static void Run(Arguments args) + public static void Unpack(string[] args) { - BlitzVfs vfs = new(); + if (args.Length < 2) + { + throw new ArgumentException("Missing required working directory argument"); + } + + string workingDirectory = args[1]; + string paksDirectory = Path.Combine(workingDirectory, "Blitz/Content/Paks"); + string[] files = Directory.GetFiles(paksDirectory, "*.pak"); + + foreach (string file in files) + { + Console.WriteLine($"Reading \"{file}\""); + } + + // BlitzVfs vfs = new(); - vfs.Initialize(); + // vfs.Initialize(); // DefaultFileProvider provider = new( // directory: new( diff --git a/src/CLI/Models/Arguments.cs b/src/CLI/Models/Arguments.cs deleted file mode 100644 index 33f8fe8cd..000000000 --- a/src/CLI/Models/Arguments.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace CLI.Models -{ - public class Arguments - { - public string[] raw; - public bool sanitize; - - public Arguments(string[] args) - { - raw = args; - sanitize = args.Contains("--sanitize"); - - if (args.Length < 1) - { - throw new ArgumentException("No arguments provided"); - } - } - } -} diff --git a/src/CLI/Program.cs b/src/CLI/Program.cs index fa17e4c5d..cb70fa3af 100644 --- a/src/CLI/Program.cs +++ b/src/CLI/Program.cs @@ -1,5 +1,4 @@ using CLI.Functions; -using CLI.Models; namespace CLI { @@ -7,15 +6,18 @@ class Program { static void Main(string[] args) { - Arguments arguments = new(args); - switch (args[0]) { - case "dlc": + case "unpack": { - DLC.Run(arguments); + Unpacker.Unpack(args); break; } + + default: + { + throw new ArgumentException("Invalid command"); + } } } }