mirror of
https://github.com/PorktoberRevolution/ReStocked
synced 2024-09-01 17:34:42 +00:00
allow empty lines and comments in blacklist/whitelist
This commit is contained in:
parent
740242c5fd
commit
366a354688
Binary file not shown.
@ -9,6 +9,7 @@ namespace Restock
|
||||
[KSPAddon(KSPAddon.Startup.Instantly, true)]
|
||||
public class ResourceBlacklist : MonoBehaviour
|
||||
{
|
||||
private readonly string[] commentSep = { "//" };
|
||||
private void Start()
|
||||
{
|
||||
HashSet<UrlDir.UrlFile> blacklist = new HashSet<UrlDir.UrlFile>();
|
||||
@ -23,7 +24,10 @@ namespace Restock
|
||||
Debug.Log($"[Restock] Reading blacklist {file.url}.{file.fileExtension}");
|
||||
foreach (string line in File.ReadAllLines(file.fullPath))
|
||||
{
|
||||
foreach (UrlDir.UrlFile blacklistFile in FindFiles(line, gameData))
|
||||
string lineBeforeComment = line.Split(commentSep, 2, StringSplitOptions.None)[0].Trim();
|
||||
if (lineBeforeComment == string.Empty) continue;
|
||||
|
||||
foreach (UrlDir.UrlFile blacklistFile in FindFiles(lineBeforeComment, gameData))
|
||||
{
|
||||
blacklist.Add(blacklistFile);
|
||||
}
|
||||
@ -34,7 +38,10 @@ namespace Restock
|
||||
Debug.Log($"[Restock] Reading whitelist {file.url}.{file.fileExtension}");
|
||||
foreach (string line in File.ReadAllLines(file.fullPath))
|
||||
{
|
||||
foreach (UrlDir.UrlFile whitelistFile in FindFiles(line, gameData))
|
||||
string lineBeforeComment = line.Split(commentSep, 2, StringSplitOptions.None)[0].Trim();
|
||||
if (lineBeforeComment == string.Empty) continue;
|
||||
|
||||
foreach (UrlDir.UrlFile whitelistFile in FindFiles(lineBeforeComment, gameData))
|
||||
{
|
||||
whitelist.Add(whitelistFile);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user