public void Awake() { for (int i = 0; i < PartVolume.FILE_VERSION - 1; i++) { if (File.Exists(PartVolume.FileName(i))) { File.Delete(PartVolume.FileName(i)); } } }
private void Awake() { Instance = this; #if DEBUG Log = new Log("KSP_PartVolume", Log.LEVEL.INFO); #else Log = new Log("KSP_PartVolume", Log.LEVEL.ERROR); #endif //VOL_CFG_FILE = KSPUtil.ApplicationRootPath + "GameData/partVolumes.cfg"; VOL_CFG_FILE = FileName(FILE_VERSION); CFG_FILE = KSPUtil.ApplicationRootPath + "GameData/" + MODDIR + "/PluginData/KSP_PartVolume.cfg"; KIFA = KSPUtil.ApplicationRootPath + "GameData/KerbalInventoryForAll/AllowModPartsInStock.cfg"; RES_BLACKLIST = KSPUtil.ApplicationRootPath + "GameData/" + MODDIR + "/PluginData/ResourceBlacklist.txt"; var blacklistFile = File.ReadAllLines(RES_BLACKLIST); resourceBlackList = new List <string>(blacklistFile); partBlacklist = new List <string>(); partWhitelist = new List <String>(); ConfigNode[] partBlacklistNodes = GameDatabase.Instance.GetConfigNodes(PARTBLACKLIST); foreach (var n in partBlacklistNodes) { var v = n.GetValues("blacklistPart"); foreach (var v1 in v) { partBlacklist.Add(v1); } var patterns = n.GetValues("blacklistRegexPattern"); blacklistRegexPattern = String.Join("|", patterns.Select(x => "(" + x + ")")); } foreach (var p in partBlacklist) { Log.Info("Part blacklisted: " + p); } ConfigNode[] partWhitelistNodes = GameDatabase.Instance.GetConfigNodes(PARTWHITELIST); foreach (var n in partWhitelistNodes) { var v = n.GetValues("whitelistPart"); foreach (var v1 in v) { partWhitelist.Add(v1); } //var patterns = n.GetValues("whitelistRegexPattern"); //WhitelistRegexPattern = String.Join("|", patterns.Select(x => "(" + x + ")")); } foreach (var p in partWhitelist) { Log.Info("Part whitelisted: " + p); } }