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 H_Tactics.Save(file); }
public HomTactControl() { // Check if the file does not exist if (File.Exists(_file)) { H_Tactics.Load(_file); // Throw a new file not found exception //throw new FileNotFoundException("Default file could not be located.", _file); } // Load the homunculus tactics from the file // Pregenerated designer code InitializeComponent(); }
public HomTactControl(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 homunculus tactics from the file H_Tactics.Load(_file); // Pregenerated designer code InitializeComponent(); }
public void Open(string file) { // Load the homunculus tactics from the file H_Tactics.Load(file); // Create a new array of tactics objects Tact[] items = new Tact[H_Tactics.Tactics.Count]; // Copy the H_Tactics tactics to the new array H_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; }