mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 11:17:05 +02:00
feat: rename cli
This commit is contained in:
1 parent
157fa0c1dd
commit
74a8df6842
18 files changed
+1419
-33
No files matched your search
@@ -0,0 +1,87 @@
|
||||
using CUE4Parse.FileProvider;
|
||||
using CUE4Parse.FileProvider.Objects;
|
||||
|
||||
namespace BlitzKit.CLI.Models
|
||||
{
|
||||
public class BlitzProvider : DefaultFileProvider
|
||||
{
|
||||
private static readonly string LOCAL_USER = "coola";
|
||||
private static readonly string LOCAL_DLC_CONTAINERS_PATH =
|
||||
$"C:/Users/{LOCAL_USER}/AppData/Local/Blitz/Saved/PersistentDownloadDir/Dlc/PakCache";
|
||||
private static readonly string LOCAL_BUNDLED_CONTAINERS_PATH =
|
||||
"C:/Program Files (x86)/Steam/steamapps/common/World of Tanks Blitz Playtest/Blitz/Content/Paks";
|
||||
|
||||
public readonly VfsDirectory RootDirectory = new();
|
||||
|
||||
public BlitzProvider()
|
||||
: base(
|
||||
directory: new DirectoryInfo(LOCAL_BUNDLED_CONTAINERS_PATH),
|
||||
extraDirectories: [new(LOCAL_DLC_CONTAINERS_PATH)],
|
||||
searchOption: SearchOption.TopDirectoryOnly
|
||||
)
|
||||
{
|
||||
Initialize();
|
||||
Mount();
|
||||
|
||||
foreach (var file in Files)
|
||||
{
|
||||
var gameFile = file.Value;
|
||||
var path = gameFile.Path.Split('/');
|
||||
var lastPathSegment = path.Last();
|
||||
var directory = RootDirectory;
|
||||
|
||||
foreach (var segment in path)
|
||||
{
|
||||
bool isLastSegment = lastPathSegment == segment;
|
||||
|
||||
if (isLastSegment)
|
||||
{
|
||||
directory.AddFile(segment, gameFile);
|
||||
}
|
||||
else if (directory.HasDirectory(segment))
|
||||
{
|
||||
directory = directory.GetDirectory(segment);
|
||||
}
|
||||
else
|
||||
{
|
||||
VfsDirectory newDirectory = new();
|
||||
directory.AddDirectory(segment, newDirectory);
|
||||
directory = newDirectory;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class VfsDirectory
|
||||
{
|
||||
public Dictionary<string, VfsDirectory> Directories = [];
|
||||
public Dictionary<string, GameFile> Files = [];
|
||||
|
||||
public void AddFile(string name, GameFile file) => Files.TryAdd(name, file);
|
||||
|
||||
public bool HasFile(string name) => Files.ContainsKey(name);
|
||||
|
||||
public GameFile GetFile(string name) => Files[name];
|
||||
|
||||
public bool HasDirectory(string name) => Directories.ContainsKey(name);
|
||||
|
||||
public VfsDirectory GetDirectory(string name)
|
||||
{
|
||||
var segments = name.Split('/');
|
||||
var directory = this;
|
||||
|
||||
foreach (var segment in segments)
|
||||
{
|
||||
directory = directory.GetImmediateDirectory(segment);
|
||||
}
|
||||
|
||||
return directory;
|
||||
}
|
||||
|
||||
private VfsDirectory GetImmediateDirectory(string name) => Directories[name];
|
||||
|
||||
public void AddDirectory(string name, VfsDirectory directory) =>
|
||||
Directories.Add(name, directory);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace BlitzKit.CLI.Models
|
||||
{
|
||||
public partial class DlcManifest
|
||||
{
|
||||
[JsonPropertyName("contentBuildId")]
|
||||
public string ContentBuildId { get; set; }
|
||||
|
||||
[JsonPropertyName("pakFiles")]
|
||||
public List<PakFile> PakFiles { get; set; }
|
||||
|
||||
[JsonPropertyName("chunkTags")]
|
||||
public Dictionary<string, ChunkTag> ChunkTags { get; set; }
|
||||
|
||||
[JsonPropertyName("chunkDependencies")]
|
||||
public List<ChunkDependency> ChunkDependencies { get; set; }
|
||||
}
|
||||
|
||||
public partial class ChunkDependency
|
||||
{
|
||||
[JsonPropertyName("chunkId")]
|
||||
public long ChunkId { get; set; }
|
||||
|
||||
[JsonPropertyName("parentChunkId")]
|
||||
public long ParentChunkId { get; set; }
|
||||
}
|
||||
|
||||
public partial class ChunkTag
|
||||
{
|
||||
[JsonPropertyName("gameplayTags")]
|
||||
public List<GameplayTag> GameplayTags { get; set; }
|
||||
}
|
||||
|
||||
public partial class GameplayTag
|
||||
{
|
||||
[JsonPropertyName("tagName")]
|
||||
public string TagName { get; set; }
|
||||
}
|
||||
|
||||
public partial class PakFile
|
||||
{
|
||||
[JsonPropertyName("fileName")]
|
||||
public string FileName { get; set; }
|
||||
|
||||
[JsonPropertyName("fileSize")]
|
||||
public long FileSize { get; set; }
|
||||
|
||||
[JsonPropertyName("fileVersion")]
|
||||
public string FileVersion { get; set; }
|
||||
|
||||
[JsonPropertyName("chunkId")]
|
||||
public long ChunkId { get; set; }
|
||||
|
||||
[JsonPropertyName("relativeUrl")]
|
||||
public string RelativeUrl { get; set; }
|
||||
|
||||
[JsonPropertyName("availabilityMask")]
|
||||
public long AvailabilityMask { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace BlitzKit.CLI.Models
|
||||
{
|
||||
public class LocalManifestPakFile
|
||||
{
|
||||
public long FileSize { get; set; }
|
||||
public required string FileHash { get; set; }
|
||||
}
|
||||
|
||||
public class LocalManifest
|
||||
{
|
||||
public required Dictionary<string, LocalManifestPakFile> PakFiles { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user