public static void Serialize(string filename, Configuration config) { var serializer = new XmlSerializer(typeof(Configuration)); using (var writer = new StreamWriter(filename)) { config.OnPreSerialize(); serializer.Serialize(writer, config); } }
private void LoadState(ConfigNode configNode) { if (configNode != null) { if (configNode.HasValue("useStockSkin")) { if (configNode.GetValue("useStockSkin") == "true") { configNode.SetValue("useStockSkin", "true"); } } if (configNode.HasValue("useOldPresetEditor")) { if (configNode.GetValue("useOldPresetEditor") == "true") { configNode.SetValue("useOldPresetEditor", "true"); } } } m_Configuration = Configuration.Deserialize(GetAbsoluteConfigurationPath()); if (m_Configuration == null) { m_Configuration = new Configuration(); Configuration.Serialize(GetAbsoluteConfigurationPath(), m_Configuration); } m_FlightManager.m_Configuration = m_Configuration; }