From 53c740f7b2a7c4204d06f07e0a9ffe2a91f91311 Mon Sep 17 00:00:00 2001 From: Chomp Date: Sat, 8 Feb 2025 21:26:51 +0000 Subject: [PATCH] Further implemented bundle loader --- Libraries/Core/Loaders/BundleLoader.cs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Libraries/Core/Loaders/BundleLoader.cs b/Libraries/Core/Loaders/BundleLoader.cs index 1b1be090..a637ad53 100644 --- a/Libraries/Core/Loaders/BundleLoader.cs +++ b/Libraries/Core/Loaders/BundleLoader.cs @@ -19,7 +19,7 @@ namespace Core.Loaders get; } - public long Crc + public string Crc { get; } @@ -32,7 +32,7 @@ namespace Core.Loaders public BundleInfo( string modPath, IBundleManifestEntry bundle, - long bundleHash) + string bundleHash) { ModPath = modPath; Bundle = bundle; @@ -97,17 +97,18 @@ namespace Core.Loaders foreach (var bundleManifest in bundleManifestArr) { - // modpath.slice(0, -1).replace(/\\/ g, "/"); - // var bundleLocalPath = $"{modpath}bundles/${bundleManifest.key}".replace(/\\/g, "/"); + // TODO: complete + var relativeModPath = modPath.Substring(0, -1); //.replace(/\\/g, "/"); + var bundleLocalPath = Path.Combine(modPath, "bundles", bundleManifest.Key); //.replace(/\\/g, "/"); - // if (!_bundleHashCacheService.CalculateAndMatchHash(bundleLocalPath)) - // { - // _bundleHashCacheService.CalculateAndStoreHash(bundleLocalPath); - // } + if (!_bundleHashCacheService.CalculateAndMatchHash(bundleLocalPath)) + { + _bundleHashCacheService.CalculateAndStoreHash(bundleLocalPath); + } - // var bundleHash = _bundleHashCacheService.GetStoredValue(bundleLocalPath); + var bundleHash = _bundleHashCacheService.GetStoredValue(bundleLocalPath); - // AddBundle(bundleManifest.key, new BundleInfo(relativeModPath, bundleManifest, bundleHash)); + AddBundle(bundleManifest.Key, new BundleInfo(relativeModPath, bundleManifest, bundleHash)); } }