public void Load(ConfigNode node) { if (node.HasNode(configNodeName)) { ConfigNode settingsNode = node.GetNode(configNodeName); settingsNode.TryGetValue("IsNewSave", ref IsNewSave); knownCrew.Clear(); var crewNodes = settingsNode.GetNodes(CrewMemberInfo.ConfigNodeName); foreach (ConfigNode crewNode in crewNodes) { CrewMemberInfo crewMemberInfo = CrewMemberInfo.Load(crewNode); knownCrew[crewMemberInfo.name] = crewMemberInfo; } knownVessels.Clear(); var vesselNodes = settingsNode.GetNodes(VesselInfo.ConfigNodeName); foreach (ConfigNode vesselNode in vesselNodes) { if (vesselNode.HasValue("Guid")) { Guid id = new Guid(vesselNode.GetValue("Guid")); VesselInfo vesselInfo = VesselInfo.Load(vesselNode); knownVessels[id] = vesselInfo; } } } }
public void Load(ConfigNode node) { if (node.HasNode(configNodeName)) { ConfigNode settingsNode = node.GetNode(configNodeName); IsNewSave = Utilities.GetValue(settingsNode, "IsNewSave", IsNewSave); Enabled = Utilities.GetValue(settingsNode, "Enabled", Enabled); HibernateInsteadOfKill = Utilities.GetValue(settingsNode, "HibernateInsteadOfKill", HibernateInsteadOfKill); RespawnDelay = Utilities.GetValue(settingsNode, "RespawnDelay", RespawnDelay); knownCrew.Clear(); var crewNodes = settingsNode.GetNodes(CrewMemberInfo.ConfigNodeName); foreach (ConfigNode crewNode in crewNodes) { CrewMemberInfo crewMemberInfo = CrewMemberInfo.Load(crewNode); knownCrew[crewMemberInfo.name] = crewMemberInfo; } knownVessels.Clear(); var vesselNodes = settingsNode.GetNodes(VesselInfo.ConfigNodeName); foreach (ConfigNode vesselNode in vesselNodes) { if (vesselNode.HasValue("Guid")) { Guid id = new Guid(vesselNode.GetValue("Guid")); VesselInfo vesselInfo = VesselInfo.Load(vesselNode); knownVessels[id] = vesselInfo; } } } }
public void Load(ConfigNode node) { if (node.HasNode(configNodeName)) { ConfigNode settingsNode = node.GetNode(configNodeName); settingsNode.TryGetValue("Version", ref file_full_version); settingsNode.TryGetValue("IsNewSave", ref IsNewSave); if (IsNewSave) { GetNewFileVersion(); compatible = true; } else { CheckFileVersion(); } knownVessels.Clear(); var vesselNodes = settingsNode.GetNodes(VesselInfo.ConfigNodeName); foreach (ConfigNode vesselNode in vesselNodes) { if (vesselNode.HasValue("Guid")) { Guid id = new Guid(vesselNode.GetValue("Guid")); VesselInfo vesselInfo = VesselInfo.Load(vesselNode); knownVessels[id] = vesselInfo; } } knownCrew.Clear(); var crewNodes = settingsNode.GetNodes(CrewMemberInfo.ConfigNodeName); foreach (ConfigNode crewNode in crewNodes) { CrewMemberInfo crewMemberInfo = CrewMemberInfo.Load(crewNode); knownCrew[crewMemberInfo.name] = crewMemberInfo; if (knownVessels.Contains(crewMemberInfo.vesselId)) { knownVessels[crewMemberInfo.vesselId].CrewInVessel.Add(crewMemberInfo); } } } if (!compatible) { ProcessSaveUpgrade(); } }