コード例 #1
0
        public static Configuration Load(string fileName)
        {
            if (!File.Exists(fileName))
            {
                throw new FileNotFoundException(fileName);
            }
            Configuration c   = new Configuration();
            XmlDocument   xml = new XmlDocument();

            xml.Load(fileName);
            c._rs232Configuration = RS232Configuration.Load(xml.SelectSingleNode("/configuration/rs232"));
            XmlNodeList nodes = xml.SelectNodes("/configuration/lcds/lcd");

            if (nodes != null && nodes.Count > 0)
            {
                List <LCD> lcds = new List <LCD>();
                foreach (XmlNode node in nodes)
                {
                    lcds.Add(LCD.Load(node));
                }
                c._lcds = lcds.ToArray();
            }
            return(c);
        }