private void LoadConfig() { var fullPath = Path.Combine(Main.Instance.CurrentInstance.CkanDir(), ConfigPath); if (!File.Exists(fullPath)) { return; } var partManagerPath = Path.Combine(Main.Instance.CurrentInstance.CkanDir(), "PartManager"); if (!Directory.Exists(partManagerPath)) { Directory.CreateDirectory(partManagerPath); } var cachePath = Path.Combine(partManagerPath, "cache"); if (!Directory.Exists(cachePath)) { Directory.CreateDirectory(cachePath); } var json = File.ReadAllText(fullPath); PartManagerConfig config = (PartManagerConfig)JsonConvert.DeserializeObject <PartManagerConfig>(json); foreach (var item in config.disabledParts) { m_DisabledParts.Add(item.Key, ConfigNodeReader.FileToConfigNode(Path.Combine(cachePath, item.Key))); } }
private ConfigNode LoadPart(string part) { var kspDir = Main.Instance.CurrentInstance.GameDir(); var fullPath = Path.Combine(kspDir, part); if (!File.Exists(fullPath)) { var partManagerPath = Path.Combine(Main.Instance.CurrentInstance.CkanDir(), "PartManager"); var cachePath = Path.Combine(partManagerPath, "cache"); fullPath = Path.Combine(cachePath, part); if (!File.Exists(fullPath)) { return(null); } } var configNode = ConfigNodeReader.FileToConfigNode(fullPath); return(configNode); }
public static ConfigNode Load(string fileFullName) { return(ConfigNodeReader.FileToConfigNode(fileFullName)); }