示例#1
0
        private static void AddConfig(TaskConf config, string name)
        {
            Stream         myStream       = null;
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.FileName = name;
            myStream = openFileDialog.OpenFile();

            StreamReader read = new StreamReader(myStream);
            string       xml  = read.ReadToEnd();

            read.Close();

            XDocument doc = XDocument.Parse(xml);

            XElement[] mxe = doc.Root.Elements().ToArray();
            for (int i = 0; i < mxe.Length; i++)
            {
                config.Add(mxe[i]);
            }
        }