Exemple #1
0
        public static List <ConfigurationFrame> Deserialize(IEnumerable <XElement> elms)
        {
            List <ConfigurationFrame> rgFrames = new List <ConfigurationFrame>();
            List <XElement>           rgElm    = SerializeToXml.GetElements(elms, "Frame");

            foreach (XElement elm in rgElm)
            {
                ConfigurationFrame frame = ConfigurationFrame.Deserialize(elm);
                rgFrames.Add(frame);
            }

            return(rgFrames);
        }
Exemple #2
0
        public static Configuration LoadFromFile(string strFile)
        {
            Configuration config = new Configuration();
            string        strXml;

            using (FileStream fs = new FileStream(strFile, FileMode.Open, FileAccess.Read, FileShare.Read))
                using (StreamReader sr = new StreamReader(fs))
                {
                    strXml = sr.ReadToEnd();
                }

            if ((int)strXml[0] == 65533 && (int)strXml[1] == 65533)
            {
                strXml = strXml.Substring(3);
            }

            XDocument doc = XDocument.Parse(strXml);

            config.Surface = ConfigurationSurface.Deserialize(doc.Descendants());
            config.Frames  = ConfigurationFrame.Deserialize(doc.Descendants());

            return(config);
        }