public void SaveItem(string name, CSt <Library> _data) { data = _data; Stream stream = null; IFormatter formatter = new BinaryFormatter(); stream = new FileStream(name + ext, FileMode.Create, FileAccess.Write, FileShare.None); formatter.Serialize(stream, this); if (stream != null) { stream.Close(); } }
private void Form2_Load_1(object sender, EventArgs e) { CurLib = new Library(); NewLib = new Library("Im.Lenina", new Address("Novosib", "Lenina", 2, 1), 228); CurLib.add_book("Wtar Sars", "J.J. Ab", 2015, 200, 1, 1); libraries.Add(CurLib); libraries.Add(NewLib); CurLib.add_reader("Oleg", new Address("lsk", "Lenina", 3, 1), 245); libStack = new CSt <Library>(CurLib); RefillCombo(); }
private void Form1_Load(object sender, EventArgs e) { CurLib = new Library(); CurLib.add_book("Wtar Sars", "J.J. Ab", 2017, 200, 0, 1, 1); NewLib = new Library("New library", new Address("Nsk", "Nim-Dan", 70, 5), 386784); NewLib.add_book("Kolobok", "Narodnaya", 1854, 300, 0, 1, 2); libraries.Add(CurLib); libraries.Add(NewLib); // Заполнить ещё библиотеки //libStack = new LibStack(CurLib); libStack = new CSt <Library>(CurLib); CurLib = new BookShop("BookyShop", new Address("Best City", "New Street", 10, 64), 908, 100); libraries.Add(CurLib); libStack = libStack.push(CurLib); RefillCombo(); }
private void button5_Click(object sender, EventArgs e) { libStack = libStack.push(newl); }
private void button7_Click(object sender, EventArgs e) { Save sv = new Save(); libStack = sv.LoadItem("test"); }