internal static void ParseConfig(KKLaunchSite site, ConfigNode cfgNode) { if (!initialized) { InitTypes(); } foreach (var field in launchSiteFields.Values) { if (Attribute.IsDefined(field, typeof(CFGSetting))) { ConfigUtil.ReadCFGNode(site, field, cfgNode); } } foreach (var field in launchSiteProperties.Values) { if (Attribute.IsDefined(field, typeof(CFGSetting))) { ConfigUtil.ReadCFGNode(site, field, cfgNode); } if (field.Name == "OpenCloseState") { site.defaultState = site.openString; } } site.FacilityType = site.GetType().Name; }
internal static void WriteConfig(KKLaunchSite site, ConfigNode cfgNode) { if (!initialized) { InitTypes(); } // Close everything before saving. site.SetClosed(); cfgNode.SetValue("FacilityType", site.GetType().Name, true); foreach (var field in launchSiteFields) { if (Attribute.IsDefined(field.Value, typeof(CFGSetting))) { if (field.Value.GetValue(site) == null) { continue; } ConfigUtil.Write2CfgNode(site, field.Value, cfgNode); } } foreach (var field in launchSiteProperties) { if (field.Key == "OpenCloseState") { cfgNode.SetValue("OpenCloseState", site.defaultState, true); continue; } if (Attribute.IsDefined(field.Value, typeof(CFGSetting))) { ConfigUtil.Write2CfgNode(site, field.Value, cfgNode); } } }