public Part(ConfigNode cfgNode) { Fields = new MixedCollection <string, string>(cfgNode.GetAllValues()); Modules = new MixedCollection <string, ConfigNode>(cfgNode.GetNodes("MODULE").Select(m => new CfgNodeValue <string, ConfigNode>(m.Value.GetValue("name").Value, m.Value))); Resources = new MixedCollection <string, ConfigNode>(cfgNode.GetNodes("RESOURCE").Select(m => new CfgNodeValue <string, ConfigNode>(m.Value.GetValue("name").Value, m.Value))); Events = cfgNode.GetNode("EVENTS")?.Value; Actions = cfgNode.GetNode("ACTIONS")?.Value; Effects = cfgNode.GetNode("EFFECTS")?.Value; Partdata = cfgNode.GetNode("PARTDATA")?.Value; VesselNaming = cfgNode.GetNode("VESSELNAMING")?.Value; }
public Vessel(ConfigNode cfgNode) { Fields = new MixedCollection <string, string>(cfgNode.GetAllValues()); Parts = new MixedCollection <uint, Part>(cfgNode.GetNodes("PART").Select(n => new CfgNodeValue <uint, Part>(uint.Parse(n.Value.GetValues("uid")[0].Value), new Part(n.Value)))); Orbit = new MixedCollection <string, string>(cfgNode.GetNodes("ORBIT").First().Value.GetAllValues().Select(n => new CfgNodeValue <string, string>(n.Key, n.Value))); ActionGroups = new MixedCollection <string, string>(cfgNode.GetNodes("ACTIONGROUPS").First().Value.GetAllValues().Select(n => new CfgNodeValue <string, string>(n.Key, n.Value))); Discovery = cfgNode.GetNodes("DISCOVERY").First().Value; FlightPlan = cfgNode.GetNodes("FLIGHTPLAN").First().Value; Target = cfgNode.GetNodes("TARGET").FirstOrDefault()?.Value; Waypoint = cfgNode.GetNodes("WAYPOINT").FirstOrDefault()?.Value; CtrlState = cfgNode.GetNodes("CTRLSTATE").First().Value; VesselModules = cfgNode.GetNodes("VESSELMODULES").First().Value; }