/// <summary> /// Loads all of the hack info files into the hak check list box. /// </summary> protected void LoadHakInfoList(CheckedListBox checkedHaks) { // Get all of the modules in the module directory and add them to // the list box. string[] haks = Directory.GetFiles(NWNInfo.GetPathForFile("foo.hif"), "*.hif"); foreach (string hak in haks) { // Load the HIF now and perform validation before adding it to the // list of HIFs. HakInfo hif = new HakInfo(hak); string error; if (hif.Validate(out error)) checkedHaks.Items.Add(hif); else MessageBox.Show(error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (0 == checkedHaks.Items.Count) { MessageBox.Show(StringResources.GetString("NoHIFS"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); Hide(); Application.Exit(); } }
/// <summary> /// Validates the single HIF and throws an EntryPointNotFoundException /// to exit the application if it does not validate. /// </summary> private void ValidateHIF() { hif = new HakInfo(NWNInfo.GetFullFilePath(MainForm.Hif)); // Validate the PRC pack HIF, if validation fails then display // the error message and exit the app. string error; if (!hif.Validate(out error)) { MessageBox.Show(error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw new EntryPointNotFoundException(); } }