//Load method, once form it initially loaded, will scan directory for .bin files to load into profiles private void FormMusicPlayer_Load(object sender, EventArgs e) { string[] files = System.IO.Directory.GetFiles(Directory.GetCurrentDirectory(), "*.bin"); for (int i = 0; i < files.Length; i++) { BinaryIO io = new BinaryIO(); Profile profile = io.BinaryRead(files[i]); profiles.AddUser(profile.User); RefreshProfiles(); } }
//function that reads a user and playlist from a binary file private void ReadProfileFromFile(string profileName) { string filename = profileName + ".bin"; BinaryIO io = new BinaryIO(); Profile profile = io.BinaryRead(filename); playList = profile.List; numSongs = playList.Length; FillBinaryTree(); RefreshList(); }