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); } }
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); } }