예제 #1
0
        CConfigData GetConfigData()
        {
            CConfigData       configdata = new CConfigData();
            CSourceConfigData sourceconfigdata;

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