private void loadPreviousButton_Click(object sender, EventArgs e) { var loadLoc = new StringBuilder(); if ((new LoadRulesWindow(ref loadLoc, 1)).ShowDialog() == DialogResult.OK) { var formatter = new BinaryFormatter(); var reader = new FileStream(_appData + Path.DirectorySeparatorChar + loadLoc.ToString() + "_stats.bin", FileMode.Open, FileAccess.Read); var statsWindow = new StatsWindow((RenamingStats)formatter.Deserialize(reader)); statsWindow.Show(); reader.Close(); } }
private void loadPreviousButton_Click(object sender, EventArgs e) { var list = new List <string>(); foreach (var item in Directory.GetFiles(Core._appData, "*_stats.bin")) { list.Add(Path.GetFileNameWithoutExtension(item).Replace("_stats", "")); } var loadStatsWindow = new CustomListDialog("Load...", list, "OK", "Cancel"); if (loadStatsWindow.ShowDialog() == DialogResult.OK) { var formatter = new BinaryFormatter(); var reader = new FileStream(_appData + Path.DirectorySeparatorChar + loadStatsWindow.SelectedItem + "_stats.bin", FileMode.Open, FileAccess.Read); var statsWindow = new StatsWindow((RenamingStats)formatter.Deserialize(reader)); statsWindow.Show(); reader.Close(); } loadStatsWindow.Dispose(); }