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 SReader Serialize()
 {
     SReader result = new SReader();
     result.ID = this.ID;
     result.Name = this.Imie;
     result.Surname = this.Nazwisko;
     return result;
 }
 public Reader(SReader r)
     : this(r.Name, r.Surname, r.ID)
 {
 }