From 3614a28b7a24e99ce136e966f76d8cade8e46510 Mon Sep 17 00:00:00 2001 From: Archangel Date: Sun, 15 Jun 2025 20:08:41 +0200 Subject: [PATCH] Remove unused service --- .../Services/Cache/ModHashCacheService.cs | 56 ------------------- 1 file changed, 56 deletions(-) delete mode 100644 Libraries/SPTarkov.Server.Core/Services/Cache/ModHashCacheService.cs diff --git a/Libraries/SPTarkov.Server.Core/Services/Cache/ModHashCacheService.cs b/Libraries/SPTarkov.Server.Core/Services/Cache/ModHashCacheService.cs deleted file mode 100644 index a42083e5..00000000 --- a/Libraries/SPTarkov.Server.Core/Services/Cache/ModHashCacheService.cs +++ /dev/null @@ -1,56 +0,0 @@ -using SPTarkov.DI.Annotations; -using SPTarkov.Server.Core.Models.Utils; -using SPTarkov.Server.Core.Utils; -using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; - -namespace SPTarkov.Server.Core.Services.Cache; - -[Injectable] -public class ModHashCacheService( - ISptLogger _logger, - JsonUtil _jsonUtil, - HashUtil _hashUtil, - FileUtil _fileUtil -) -{ - protected readonly string _modCachePath = "./user/cache/modCache.json"; - protected readonly Dictionary _modHashes = new(); - - public string? GetStoredValue(string key) - { - _modHashes.TryGetValue(key, out var value); - - return value; - } - - public void StoreValue(string key, string value) - { - _modHashes.TryAdd(key, value); - - _fileUtil.WriteFile(_modCachePath, _jsonUtil.Serialize(_modHashes)); - - if (_logger.IsLogEnabled(LogLevel.Debug)) - { - _logger.Debug($"Mod {key} hash stored in: {_modCachePath}"); - } - } - - public bool MatchWithStoredHash(string modName, string hash) - { - return GetStoredValue(modName) == hash; - } - - public bool CalculateAndCompareHash(string modName, string modContent) - { - var generatedHash = _hashUtil.GenerateHashForData(HashingAlgorithm.SHA1, modContent); - - return MatchWithStoredHash(modName, generatedHash); - } - - public void CalculateAndStoreHash(string modName, string modContent) - { - var generatedHash = _hashUtil.GenerateHashForData(HashingAlgorithm.SHA1, modContent); - - StoreValue(modName, generatedHash); - } -}