Esempio n. 1
0
        CConfigData GetConfigData()
        {
            CConfigData       configdata = new CConfigData();
            CSourceConfigData sourceconfigdata;

            foreach (CSource sr in Sources)
            {
                sourceconfigdata = sr.GetConfigData();
                configdata.SourceConfigData.Add(sourceconfigdata);
            }
            return(configdata);
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
 CConfigData GetConfigData()
 {
     CConfigData configdata = new CConfigData();
     CSourceConfigData sourceconfigdata;
     foreach (CSource sr in Sources)
     {
         sourceconfigdata = sr.GetConfigData();
         configdata.SourceConfigData.Add(sourceconfigdata);
     }
     return configdata;
 }