private LicenseParser parser      = new LicenseParser(); // used to actually execute parsing

        // Constructor called when the program begins
        public MainMenu()
        {
            InitializeComponent();
            MinimizeBox = true;
            MaximizeBox = true;
            PrefsForm.StartUp();
        }
        // Event handler for Parse button click
        private void parse_Click(object sender, EventArgs e)
        {
            // Get input text and reset parser variables
            manipulatedFile = InputParser.Parse(rawFile.Text);
            FlexNetWords.ResetReservedWords();
            cleanFile        = "";
            cleanedFile.Text = "";

            // Attempt to clean file
            try
            {
                keepThese = parser.CleanedLic(manipulatedFile);
            }
            // Handle XML lookup file not being found in the specified location (or not having a set location)
            catch (LicensesNotFoundException lnfe)
            {
                var result = MessageBox.Show(lnfe.Message + " Would you like to set the file path for the XML lookup file now?" +
                                             " The path can be set at any time via Edit > Preferences, but you will not be able to parse any files" +
                                             " without having a valid XML file path set. If you would like more details, please see the help link " +
                                             "under Help > Help Documentation.",
                                             "File Could Not Be Cleaned", MessageBoxButtons.YesNo);

                // Let user immediately specify XML location if he/she wants to
                if (result == DialogResult.Yes)
                {
                    OpenFileDialog openDialog = new OpenFileDialog();
                    openDialog.Filter = "XML Files | *.xml";
                    openDialog.ShowDialog();
                    if (!string.IsNullOrEmpty(openDialog.FileName))
                    {
                        PrefsForm.SetXML(openDialog.FileName);
                        DisplayStatus("XML selected.");
                    }
                }
                return;
            }
            // Handle an invalid license being found in the license file (e.g. missing a quote)
            catch (InvalidLicenseException ile)
            {
                var result = MessageBox.Show(ile.Message, "Invalid License File", MessageBoxButtons.OK);
            }

            // Process the parsed lines into one output text block
            for (int pos = 0; pos < keepThese.Count; pos++)
            {
                cleanFile        += keepThese[pos] + Environment.NewLine;
                cleanedFile.Text += cleanFile;
                cleanFile         = "";
            }
            DisplayStatus("File parsed.");
        }
        // Called when the user selects Preferences via hotkey or the Edit menu
        private void preferences_Click_1(object sender, EventArgs e)
        {
            PrefsForm   preferencesForm = new PrefsForm();
            RegistryKey rkHKCU          = Registry.CurrentUser.OpenSubKey("Software");

            // Our exception handling will catch a missing subdirectory structure for user preferences
            // even if we don't make this check, but most of the time if there's no MDi key under
            // Software we can assume that this is the user's first time going into preferences, so that
            // should be a good enough check to catch most cases where the user would get the jarring "prefs
            // not found" error output.
            if (!rkHKCU.GetSubKeyNames().Contains("MDi"))
            {
                preferencesForm.CreateDefault();
            }
            else
            {
                preferencesForm.Open();
            }
            rkHKCU.Close();
            preferencesForm.ShowDialog();
        }