public void DeserializeAll(List<Reader> czytelnicy, Dictionary<int, Book> ksiazki, ObservableCollection<Borrow> wypozyczenia)
        {
            using (Stream stream = File.Open(Path, FileMode.Open)) {
                    BinaryFormatter bin = new BinaryFormatter();
                    SBase baza = new SBase();
                    int readerCount = (int)bin.Deserialize(stream);

                    for (int i = 0; i < readerCount; i++) {
                        SReader s = new SReader();
                        s.ID = (int)bin.Deserialize(stream);
                        s.Name = (string)bin.Deserialize(stream);
                        s.Surname = (string)bin.Deserialize(stream);
                        baza.readers.Add(s);
                    }

                    int bookCount = (int)bin.Deserialize(stream);
                    for (int i = 0; i < bookCount; i++) {
                        SBook s = new SBook();
                        s.ID = (int)bin.Deserialize(stream);
                        s.Title = (string)bin.Deserialize(stream);
                        s.Author = (string)bin.Deserialize(stream);
                        s.Year = (int)bin.Deserialize(stream);
                        baza.books.Add(s);
                    }

                    int borrowCount = (int)bin.Deserialize(stream);
                    for (int i = 0; i < borrowCount; i++) {
                        SBorrow s = new SBorrow();
                        s.ID = (int)bin.Deserialize(stream);
                        s.ReaderID = (int)bin.Deserialize(stream);
                        s.BookID = (int)bin.Deserialize(stream);
                        s.Date = new DateTime((long)bin.Deserialize(stream));

                        baza.borrows.Add(s);
                    }
                    sb.ResetAll(czytelnicy, ksiazki, wypozyczenia);
                    sb.ConvertAll(czytelnicy, ksiazki, wypozyczenia, baza);
                }
        }
 public SBook Serialize()
 {
     SBook result = new SBook();
     result.ID = this.Numer;
     result.Title = this.Tytul;
     result.Year = this.IssueYear;
     result.Author = this.Autor;
     return result;
 }
 public Book(SBook s)
     : this(s.ID, s.Title, s.Year, s.Author)
 {
 }