Beispiel #1
0
        public cLibrary LoadSnapshotFromFile(string filename = "Library.xml")
        {
            String rawData;

            LibraryProvider.LoadStream(filename);
            XmlDocument doc = new XmlDocument();

            LibraryProvider.StreamSnapshot.Position = 0;

            doc.Load(LibraryProvider.StreamSnapshot);
            rawData = doc.InnerXml;
            XmlSerializer  serializer   = new XmlSerializer(typeof(cLibrary));
            StreamProvider StreamBackup = LibraryProvider;

            try
            {
                using (TextReader reader = new StringReader(rawData))
                {
                    cLibrary result = serializer.Deserialize(reader) as cLibrary;
                    result.LibraryProvider = StreamBackup;
                    return(result);
                }
            }
            catch
            {
                return(null);
            }
        }
Beispiel #2
0
 public cLibrary()
 {
     LibraryProvider = new StreamProvider();
 }
Beispiel #3
0
 public cUsers()
 {
     UsersStreamProvider = new StreamProvider();
 }