public void Save(string file) { // Check if the file does not exist if (!File.Exists(file)) { // Create the file File.CreateText(file); } // Save the file M_Tactics.Save(file); }
public MerTactControl(string file) { // Check if the file does not exist if (!File.Exists(file)) { // Throw a new file not found exception throw new FileNotFoundException("Specified file could not be located.", file); } // Set the file _file = file; // Load the mercenary tactics from the file M_Tactics.Load(_file); // Pregenerated designer code InitializeComponent(); }
public MerTactControl() { // Check if the file does not exist if (File.Exists(_file)) { // Load the mercenary tactics from the file M_Tactics.Load(_file); } else { // Throw a new file not found exception // throw new FileNotFoundException("Default file could not be located.", _file); } // Pregenerated designer code InitializeComponent(); }
public void Open(string file) { // Load the mercenary tactics from the file M_Tactics.Load(file); // Create a new array of tactics objects Tact[] items = new Tact[M_Tactics.Tactics.Count]; // Copy the M_Tactics tactics to the new array M_Tactics.Tactics.CopyTo(items, 0); // Clear the listBoxTactics items list listBoxTactics.Items.Clear(); // Add the new array of tactics to the listBoxTactics items list listBoxTactics.Items.AddRange(items); // Select the first item in the listBoxTactics items list listBoxTactics.SelectedIndex = 0; }
public void Save() { // Save the file M_Tactics.Save(_file); }