CConfigData GetConfigData() { CConfigData configdata = new CConfigData(); CSourceConfigData sourceconfigdata; foreach (CSource sr in Sources) { sourceconfigdata = sr.GetConfigData(); configdata.SourceConfigData.Add(sourceconfigdata); } return(configdata); }
private void SaveSourcesA(string filename) { CConfigData configdata = GetConfigData(); XmlSerializer xs = new XmlSerializer(typeof(CConfigData)); TextWriter wr = null; try { wr = new StreamWriter(filename); xs.Serialize(wr, configdata); } finally { if (wr != null) { wr.Close(); } } ConfigHasChenged = false; }
private void LoadSourcesA(string filename) { ClearSources(); CConfigData configdata = GetConfigData(); if (!File.Exists(filename)) { return; } XmlSerializer xs = null; FileStream fs = null; try { xs = new XmlSerializer(typeof(CConfigData)); fs = new FileStream(filename, FileMode.Open); configdata = (CConfigData)xs.Deserialize(fs); } catch (Exception e) { } finally { if (fs != null) { fs.Close(); } } int i; for (i = 0; i < configdata.SourceConfigData.Count; i++) { AddSource(configdata.SourceConfigData[i]); } ConfigHasChenged = false; }
CConfigData GetConfigData() { CConfigData configdata = new CConfigData(); CSourceConfigData sourceconfigdata; foreach (CSource sr in Sources) { sourceconfigdata = sr.GetConfigData(); configdata.SourceConfigData.Add(sourceconfigdata); } return configdata; }