public static void Serialize(string filename, Configuration config) { var serializer = new XmlSerializer(typeof(Configuration)); try { using (var writer = new StreamWriter(filename)) { serializer.Serialize(writer, config); } } catch (Exception ex1) { Logger.dbgLog("Had a problem saving the config file Error: ", ex1, true); } }
public void OnEnabled() { try { config = Configuration.Deserialize(MOD_CONFIG_FILENAME); if (config == null) { config = new Configuration(); Configuration.Serialize(MOD_CONFIG_FILENAME, config); } DEBUG_LOG_ON = config.DebugLogging; Logger.dbgLog(string.Concat("v", MOD_VERSION, " has been enabled.")); } catch (Exception ex) { Logger.dbgLog("",ex,true); } }