private void SaveConfig(WoopsaAdsConfig config) { XmlSerializer writer = new XmlSerializer(typeof(WoopsaAdsConfig)); using (StreamWriter wr = new StreamWriter(_configPath)) { writer.Serialize(wr, config); } }
public void LoadConfig() { if (File.Exists(_configPath)) { XmlSerializer reader = new XmlSerializer(typeof(WoopsaAdsConfig)); StreamReader file = new StreamReader(_configPath); WoopsaAdsConfig config = (WoopsaAdsConfig)reader.Deserialize(file); port = config.port; folderPathWebPages = config.folderPathWebPages; isLocal = config.isLocal; runAtStartUp = config.runAtStartUp; plcParameterList = config.plcParameterList; file.Close(); } else { SaveConfig(new WoopsaAdsConfig(port, folderPathWebPages, isLocal, runAtStartUp, plcParameterList)); plcParameterList.Insert(0, new PlcParameter("local plc", LOCAL_NET_ID)); } }