Esempio n. 1
0
        /// <summary>
        /// Deserialise a xml file into a DrawingSearchModel object.
        /// </summary>
        /// <param name="xmlPath"></param>
        /// <returns></returns>
        public static DrawingSearchModel CreateFromXml(string xmlPath)
        {
            StreamReader       sr  = new StreamReader(xmlPath);
            XmlSerializer      xml = new XmlSerializer(typeof(DrawingSearchModel));
            DrawingSearchModel d   = xml.Deserialize(sr) as DrawingSearchModel;

            return(d);
        }
Esempio n. 2
0
        /// <summary>
        /// Deserialise a string of xml data into a DrawingSearchModel object.
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static DrawingSearchModel CreateFromString(string str)
        {
            byte[]             data = ASCIIEncoding.ASCII.GetBytes(str);
            MemoryStream       ms   = new MemoryStream(data);
            XmlSerializer      xml  = new XmlSerializer(typeof(DrawingSearchModel));
            DrawingSearchModel d    = xml.Deserialize(ms) as DrawingSearchModel;

            return(d);
        }