private void Button4_Click(object sender, EventArgs e) { FolderBrowserDialog.Description = "Select folder to import Abilities from:"; if (FolderBrowserDialog.ShowDialog() == DialogResult.OK) { Text = "Please wait..."; UseWaitCursor = true; ProgressBar.Value = 0; ProgressBar.Visible = true; int LoopVar; LoopVar = 0; while (LoopVar < Conversions.ToDouble(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "NumberOfAbilities", "")) - 1d == true) { LoopVar += 1; AbilityList.SelectedIndex = LoopVar; Refresh(); Enabled = false; if (System.IO.File.Exists(FolderBrowserDialog.SelectedPath + @"\" + LoopVar + ".ini")) { ImportDataFunctions.ImportAbilityIni(FolderBrowserDialog.SelectedPath + @"\" + LoopVar + ".ini", LoopVar); } ProgressBar.Value = (int)(LoopVar / Conversions.ToDouble(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "NumberOfAbilities", "")) * 100d); } LoopVar = 0; AbilityList.Items.Clear(); while (LoopVar < Conversions.ToDouble(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "NumberOfAbilities", "")) == true) { AbilityList.Items.Add(GetNameFunctions.GetAbilityName(LoopVar)); LoopVar += 1; } AbilityList.SelectedIndex = 0; Text = "Ability Editor"; UseWaitCursor = false; Enabled = true; ProgressBar.Visible = false; BringToFront(); } }
private void Button3_Click(object sender, EventArgs e) { fileOpenDialog.FileName = ""; fileOpenDialog.CheckFileExists = true; // Check to ensure that the selected path exists. Dialog box displays // a warning otherwise. fileOpenDialog.CheckPathExists = true; // Get or set default extension. Doesn't include the leading ".". fileOpenDialog.DefaultExt = "ini"; // Return the file referenced by a link? If False, simply returns the selected link // file. If True, returns the file linked to the LNK file. fileOpenDialog.DereferenceLinks = true; // Just as in VB6, use a set of pairs of filters, separated with "|". Each // pair consists of a description|file spec. Use a "|" between pairs. No need to put a // trailing "|". You can set the FilterIndex property as well, to select the default // filter. The first filter is numbered 1 (not 0). The default is 1. fileOpenDialog.Filter = "(*.ini)|*.ini*"; fileOpenDialog.Multiselect = false; // Restore the original directory when done selecting // a file? If False, the current directory changes // to the directory in which you selected the file. // Set this to True to put the current folder back // where it was when you started. // The default is False. // .RestoreDirectory = False // Show the Help button and Read-Only checkbox? fileOpenDialog.ShowHelp = false; fileOpenDialog.ShowReadOnly = false; // Start out with the read-only check box checked? // This only make sense if ShowReadOnly is True. fileOpenDialog.ReadOnlyChecked = false; fileOpenDialog.Title = "Select ini file to import"; // Only accept valid Win32 file names? fileOpenDialog.ValidateNames = true; if (fileOpenDialog.ShowDialog() == DialogResult.OK) { ImportDataFunctions.ImportAbilityIni(fileOpenDialog.FileName, AbilityList.SelectedIndex); int refreshvar; refreshvar = AbilityList.SelectedIndex; if (AbilityList.SelectedIndex == 0) { AbilityList.SelectedIndex += 1; } else { AbilityList.SelectedIndex -= 1; } AbilityList.Items.Insert(refreshvar, GetNameFunctions.GetAbilityName(refreshvar)); AbilityList.Items.RemoveAt(refreshvar + 1); AbilityList.SelectedIndex = refreshvar; } }