mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-28 13:09:51 +01:00
feat: ini
This commit is contained in:
1 parent
14d9794f57
commit
1d28768bb7
3 files changed
+24
-10
No files matched your search
@@ -1,4 +1,6 @@
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.Unicode;
|
||||||
using Blitzkit;
|
using Blitzkit;
|
||||||
using BlitzKit.CLI.Models;
|
using BlitzKit.CLI.Models;
|
||||||
using CUE4Parse.UE4.Assets.Exports;
|
using CUE4Parse.UE4.Assets.Exports;
|
||||||
@@ -6,6 +8,7 @@ using CUE4Parse.UE4.Assets.Exports.Engine;
|
|||||||
using CUE4Parse.UE4.Assets.Exports.StaticMesh;
|
using CUE4Parse.UE4.Assets.Exports.StaticMesh;
|
||||||
using CUE4Parse.UE4.Assets.Objects;
|
using CUE4Parse.UE4.Assets.Objects;
|
||||||
using CUE4Parse.UE4.Objects.UObject;
|
using CUE4Parse.UE4.Objects.UObject;
|
||||||
|
using CUE4Parse.UE4.Pak.Objects;
|
||||||
using Google.Protobuf.Collections;
|
using Google.Protobuf.Collections;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using BlitzKit.CLI.Models;
|
using BlitzKit.CLI.Models;
|
||||||
using BlitzKit.CLI.Quicktype;
|
using BlitzKit.CLI.Quicktype;
|
||||||
using BlitzKit.CLI.Utils;
|
using BlitzKit.CLI.Utils;
|
||||||
|
using CUE4Parse.FileProvider;
|
||||||
using CUE4Parse.FileProvider.Objects;
|
using CUE4Parse.FileProvider.Objects;
|
||||||
using CUE4Parse.UE4.Pak;
|
using CUE4Parse.UE4.Pak;
|
||||||
|
using CUE4Parse.UE4.Pak.Objects;
|
||||||
using CUE4Parse.UE4.Readers;
|
using CUE4Parse.UE4.Readers;
|
||||||
|
using CUE4Parse.UE4.Versions;
|
||||||
using DotNet.Globbing;
|
using DotNet.Globbing;
|
||||||
|
|
||||||
namespace BlitzKit.CLI.Functions
|
namespace BlitzKit.CLI.Functions
|
||||||
@@ -27,22 +31,31 @@ namespace BlitzKit.CLI.Functions
|
|||||||
throw new ArgumentException("Missing required initial paks directory");
|
throw new ArgumentException("Missing required initial paks directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var pak0Path = Path.Combine(TEMP_DEPOT_DIR, "Blitz/Content/Paks/pakchunk0-Windows.pak");
|
||||||
|
DefaultFileProvider provider0 = new(
|
||||||
|
directory: new DirectoryInfo(pak0Path),
|
||||||
|
searchOption: SearchOption.TopDirectoryOnly,
|
||||||
|
versions: new(EGame.GAME_UE5_3)
|
||||||
|
);
|
||||||
|
provider0.Initialize();
|
||||||
|
provider0.Mount();
|
||||||
|
provider0.TryFindGameFile("Blitz/Config/DefaultDlc.ini", out var defaultDlcGameFile);
|
||||||
|
|
||||||
|
if (defaultDlcGameFile is not FPakEntry)
|
||||||
|
throw new Exception("Failed to find DefaultDlc.ini");
|
||||||
|
|
||||||
|
IniParser defaultDlc = new(Encoding.UTF8.GetString(defaultDlcGameFile.Read()));
|
||||||
|
|
||||||
using HttpClient client = new();
|
using HttpClient client = new();
|
||||||
string defaultDlcPath = Path.Combine(VFS_PATH, "Blitz/Config/DefaultDlc.ini");
|
string? contentBuildId = defaultDlc.GetString("DefaultContentBuildId");
|
||||||
IniParser iniParser = new(defaultDlcPath);
|
|
||||||
string? contentBuildId = iniParser.GetString("DefaultContentBuildId");
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(contentBuildId))
|
if (string.IsNullOrEmpty(contentBuildId))
|
||||||
{
|
{
|
||||||
throw new Exception("Failed to read content build id from DefaultDlc.ini");
|
throw new Exception("Failed to read content build id from DefaultDlc.ini");
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.WriteLine($"Exploring DLC \"{contentBuildId}\" within group \"{CONTENT_GROUP}\"");
|
|
||||||
|
|
||||||
DlcManifest manifest = await FetchManifest(CONTENT_GROUP, contentBuildId);
|
DlcManifest manifest = await FetchManifest(CONTENT_GROUP, contentBuildId);
|
||||||
|
|
||||||
Console.WriteLine("Filtering HD and non-HD containers");
|
|
||||||
|
|
||||||
foreach (var pakFile in manifest.PakFiles)
|
foreach (var pakFile in manifest.PakFiles)
|
||||||
{
|
{
|
||||||
var localContainerPath = Path.Combine(VFS_PATH, pakFile.FileName);
|
var localContainerPath = Path.Combine(VFS_PATH, pakFile.FileName);
|
||||||
|
|||||||
@@ -5,10 +5,8 @@ namespace BlitzKit.CLI.Utils
|
|||||||
private readonly Dictionary<string, string> strings = [];
|
private readonly Dictionary<string, string> strings = [];
|
||||||
private readonly Dictionary<string, List<string>> arrays = [];
|
private readonly Dictionary<string, List<string>> arrays = [];
|
||||||
|
|
||||||
public IniParser(string file)
|
public IniParser(string content)
|
||||||
{
|
{
|
||||||
string content = File.ReadAllText(file);
|
|
||||||
|
|
||||||
foreach (string line in content.Split('\n'))
|
foreach (string line in content.Split('\n'))
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(line))
|
if (string.IsNullOrWhiteSpace(line))
|
||||||
|
|||||||
Reference in new issue
Block a user