diff --git a/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll b/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll index e986c80d..2446d22e 100644 Binary files a/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll and b/Distribution/Restock/GameData/ReStock/Plugins/Restock.dll differ diff --git a/Source/Restock/ResourceBlacklist.cs b/Source/Restock/ResourceBlacklist.cs index 410faa3f..ce2ce09e 100644 --- a/Source/Restock/ResourceBlacklist.cs +++ b/Source/Restock/ResourceBlacklist.cs @@ -22,29 +22,17 @@ namespace Restock if (file.fileExtension == "restockblacklist") { Debug.Log($"[Restock] Reading blacklist {file.url}.{file.fileExtension}"); - foreach (string line in File.ReadAllLines(file.fullPath)) + foreach (UrlDir.UrlFile blacklistFile in FindFilesInAssetListFile(file.fullPath, gameData)) { - string lineBeforeComment = line.Split(COMMENT_SEPARATOR, 2, StringSplitOptions.None)[0].Trim(); - if (lineBeforeComment == string.Empty) continue; - - foreach (UrlDir.UrlFile blacklistFile in FindFiles(lineBeforeComment, gameData)) - { - blacklist.Add(blacklistFile); - } + blacklist.Add(blacklistFile); } } else if (file.fileExtension == "restockwhitelist") { Debug.Log($"[Restock] Reading whitelist {file.url}.{file.fileExtension}"); - foreach (string line in File.ReadAllLines(file.fullPath)) + foreach (UrlDir.UrlFile whitelistFile in FindFilesInAssetListFile(file.fullPath, gameData)) { - string lineBeforeComment = line.Split(COMMENT_SEPARATOR, 2, StringSplitOptions.None)[0].Trim(); - if (lineBeforeComment == string.Empty) continue; - - foreach (UrlDir.UrlFile whitelistFile in FindFiles(lineBeforeComment, gameData)) - { - whitelist.Add(whitelistFile); - } + whitelist.Add(whitelistFile); } } } @@ -62,8 +50,22 @@ namespace Restock Destroy(gameObject); } + private IEnumerable FindFilesInAssetListFile(string filePath, UrlDir dir) + { + foreach (string line in File.ReadAllLines(filePath)) + { + string lineBeforeComment = line.Split(COMMENT_SEPARATOR, 2, StringSplitOptions.None)[0].Trim(); + if (lineBeforeComment == string.Empty) continue; + + foreach (UrlDir.UrlFile urlFile in FindFilesForUrl(lineBeforeComment, dir)) + { + yield return urlFile; + } + } + } + private readonly char[] PATH_SEPARATOR = new[] { '/' }; - private IEnumerable FindFiles(string url, UrlDir dir) + private IEnumerable FindFilesForUrl(string url, UrlDir dir) { string[] splits = url.Split(PATH_SEPARATOR, 2); @@ -121,7 +123,7 @@ namespace Restock { if (regex.IsMatch(subDir.name)) { - foreach (UrlDir.UrlFile file in FindFiles(splits[1], subDir)) + foreach (UrlDir.UrlFile file in FindFilesForUrl(splits[1], subDir)) { yield return file; }