mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: pathing
This commit is contained in:
1 parent
8e4f4c39bb
commit
82af101f9c
5 files changed
+60
-16
No files matched your search
@@ -7,4 +7,8 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CUE4Parse" Version="1.1.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using CLI.Models;
|
||||||
|
|
||||||
|
namespace CLI.Functions
|
||||||
|
{
|
||||||
|
class DLC
|
||||||
|
{
|
||||||
|
public static void Run(Arguments args)
|
||||||
|
{
|
||||||
|
if (args.raw.Length < 2)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("No directory provided");
|
||||||
|
}
|
||||||
|
|
||||||
|
string dlcPaksDirectory = args.raw[1];
|
||||||
|
|
||||||
|
if (args.sanitize && Directory.Exists(dlcPaksDirectory))
|
||||||
|
{
|
||||||
|
Directory.Delete(dlcPaksDirectory, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
Directory.CreateDirectory(dlcPaksDirectory);
|
||||||
|
|
||||||
|
string testFilePath = Path.Combine(dlcPaksDirectory, "test.txt");
|
||||||
|
File.WriteAllText(testFilePath, "test");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace CLI.Models
|
namespace CLI.Models
|
||||||
{
|
{
|
||||||
public class PakFile
|
public class LocalManifestPakFile
|
||||||
{
|
{
|
||||||
public long FileSize { get; set; }
|
public long FileSize { get; set; }
|
||||||
public required string FileHash { get; set; }
|
public required string FileHash { get; set; }
|
||||||
@@ -8,6 +8,6 @@ namespace CLI.Models
|
|||||||
|
|
||||||
public class LocalManifest
|
public class LocalManifest
|
||||||
{
|
{
|
||||||
public required Dictionary<string, PakFile> PakFiles { get; set; }
|
public required Dictionary<string, LocalManifestPakFile> PakFiles { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+8
-14
@@ -1,27 +1,21 @@
|
|||||||
using System.Text.Json;
|
using CLI.Functions;
|
||||||
using CLI.Models;
|
using CLI.Models;
|
||||||
|
|
||||||
namespace CLI
|
namespace CLI
|
||||||
{
|
{
|
||||||
class Program
|
class Program
|
||||||
{
|
{
|
||||||
static readonly JsonSerializerOptions options = new() { PropertyNameCaseInsensitive = true };
|
|
||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
string RootDir = @"C:\Users\coola\AppData\Local\Blitz";
|
Arguments arguments = new(args);
|
||||||
string paksPath = Path.Combine(RootDir, @"Saved\PersistentDownloadDir\Dlc\PakCache");
|
|
||||||
string localManifestPath = Path.Combine(paksPath, "LocalManifest.json");
|
|
||||||
string localManifestContent = File.ReadAllText(localManifestPath);
|
|
||||||
|
|
||||||
LocalManifest localManifest =
|
switch (args[0])
|
||||||
JsonSerializer.Deserialize<LocalManifest>(localManifestContent, options)
|
|
||||||
?? throw new Exception("Failed to deserialize LocalManifest");
|
|
||||||
|
|
||||||
foreach (var pakFile in localManifest.PakFiles)
|
|
||||||
{
|
{
|
||||||
string pakFilePath = Path.Combine(paksPath, pakFile.Key);
|
case "dlc":
|
||||||
Console.WriteLine($"({pakFile.Value.FileSize}) {pakFilePath}");
|
{
|
||||||
|
DLC.Run(arguments);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user