Beispiel #1
0
        public static XmlEyeGestures ReadFromString(string xmlString)
        {
            var gestures   = new XmlEyeGestures();
            var serializer = new XmlSerializer(typeof(XmlEyeGestures));

            try
            {
                gestures = (XmlEyeGestures)serializer.Deserialize(new StringReader(xmlString));
            }
            catch { }

            return(gestures);
        }
Beispiel #2
0
        public static XmlEyeGestures ReadFromFile(string inputFilename)
        {
            if (!File.Exists(inputFilename) && string.IsNullOrEmpty(Path.GetExtension(inputFilename)))
            {
                inputFilename += ".xml";
            }

            var gestures   = new XmlEyeGestures();
            var serializer = new XmlSerializer(typeof(XmlEyeGestures));

            try
            {
                using (var reader = new FileStream(@inputFilename, FileMode.Open))
                {
                    gestures = (XmlEyeGestures)serializer.Deserialize(reader);
                    reader.Close();
                }
            }
            catch { }

            return(gestures);
        }