예제 #1
0
        public cUsers GetUsersFromSnapshot()
        {
            String rawData;

            XmlDocument doc = new XmlDocument();



            try
            {
                UsersStreamProvider.StreamSnapshot.Position = 0;
                doc.Load(UsersStreamProvider.StreamSnapshot);
                rawData = doc.InnerXml;
                XmlSerializer serializer = new XmlSerializer(typeof(cUsers));
                using (TextReader reader = new StringReader(rawData))
                {
                    cUsers result = (cUsers)serializer.Deserialize(reader);
                    result.UsersStreamProvider = UsersStreamProvider;
                    return(result);
                }
            }
            catch (Exception e)
            {
                return(null);
            }
        }
예제 #2
0
        public static cUsers GetUsers()
        {
            String rawData;

            XmlDocument doc = new XmlDocument();



            try
            {
                doc.Load("Users.xml");
                rawData = doc.InnerXml;
                XmlSerializer serializer = new XmlSerializer(typeof(cUsers));
                using (TextReader reader = new StringReader(rawData))
                {
                    cUsers result = (cUsers)serializer.Deserialize(reader);
                    return(result);
                }
            }
            catch (Exception e)
            {
                return(null);
            }
        }