public loginForm() { Directory = new Directory(); Admin = new Admin("admin", "admin"); if (!File.Exists("directory.bin")) { Directory.FillTestData(100); } else { Directory.Load(); } InitializeComponent(); }
public void Load() { using (Stream stream = File.OpenRead(filePath)) { var serializer = new BinaryFormatter(); Directory dr = (Directory)serializer.Deserialize(stream); Copy(dr.Applicants, directory.Applicants); Copy(dr.Universities, directory.Universities); } void Copy <T>(List <T> from, List <T> to) { to.Clear(); to.AddRange(from); } }
public Dao(Directory directory) { this.directory = directory; }