/// <summary>
 /// Constructor intitilizes the text boxes on the form that is to be created with the given GameData.
 /// </summary>
 /// <param name="g">GameData that is used to populate the various fields on the form.</param>
 public GameInformation(GameData g)
 {
     InitializeComponent();
     uxHomeScoreTextBox.Text = g.HomeTeamScore;
     uxHomeTextBox.Text = g.HomeTeamLocationAndNickname;
     uxVisitorScoreTextBox.Text = g.VisitingTeamScore;
     uxWinningPitcherTextBox.Text = g.WinningPitcher;
     uxLosingPitcherTextBox.Text = g.LosingPitcher;
     uxVisitorTextBox.Text = g.VisitingTeamLocationAndNickname;
     AssignValues = g;
     uxSaveTextBox.Text = g.PitcherCreditedWithSave;
     uxGameWinningRBITextBox.Text = g.BatterWinningRun;
 }
        /// <summary>
        /// Reads in a file containing game data, and adds it to a hash table for search purposes. 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void uxAddDataFileButton_Click(object sender, EventArgs e)
        {
            bool gotData = false;
            if (uxOpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    StreamReader sr = new StreamReader(uxOpenFileDialog.FileName);
                    while (sr.EndOfStream != true)
                    {
                        int counter = 0;
                        string[] allFields = new string[101];
                        string currentLine = sr.ReadLine();
                        while (counter != 101)
                        {
                            if (currentLine[0] == '"')
                            {
                                currentLine = currentLine.Substring(1);
                                int nextQuoteIndex = currentLine.IndexOf('"');
                                string field = currentLine.Substring(0, nextQuoteIndex);
                                allFields[counter] = field;
                                currentLine = currentLine.Substring(nextQuoteIndex + 2);
                                counter++;
                            }
                            else
                            {
                                int nextCommaIndex = currentLine.IndexOf(',');
                                string field = currentLine.Substring(0, nextCommaIndex);
                                allFields[counter] = field;
                                currentLine = currentLine.Substring(nextCommaIndex + 1);
                                counter++;
                            }
                        }
                        GameData currentLineData = new GameData(allFields, _teamInformation);
                        TeamAndDate homeTeam = new TeamAndDate(currentLineData.HomeTeamAbbreviation, currentLineData.Date);
                        TeamAndDate awayTeam = new TeamAndDate(currentLineData.VisitingTeamAbbreviation, currentLineData.Date);

                        if (_abbreviationsUsed.Contains(currentLineData.HomeTeamAbbreviation) != true)
                        {
                            _abbreviationsUsed.Add(currentLineData.HomeTeamAbbreviation);
                            uxComboBox.Items.Add(_teamInformation[currentLineData.HomeTeamAbbreviation]);
                            gotData = true;
                            uxComboBox.Enabled = true;
                            uxGetGameResultsButton.Enabled = true;

                        }
                        else if (_abbreviationsUsed.Contains(currentLineData.VisitingTeamAbbreviation) != true)
                        {
                            _abbreviationsUsed.Add(currentLineData.VisitingTeamAbbreviation);
                            uxComboBox.Items.Add(_teamInformation[currentLineData.VisitingTeamAbbreviation]);
                            gotData = true;
                            uxComboBox.Enabled = true;
                            uxGetGameResultsButton.Enabled = true;

                        }

                        if (_gameInformation.ContainsKey(homeTeam))
                        {
                            _gameInformation[homeTeam].Add(currentLineData);
                        }
                        else
                        {
                            List<GameData> temp = new List<GameData>();
                            temp.Add(currentLineData);
                            _gameInformation.Add(homeTeam, temp);
                        }

                        if (_gameInformation.ContainsKey(awayTeam))
                        {
                            _gameInformation[awayTeam].Add(currentLineData);
                        }
                        else
                        {
                            List<GameData> temp = new List<GameData>();
                            temp.Add(currentLineData);
                            _gameInformation.Add(awayTeam, temp);
                        }
                    }
                    uxComboBox.SelectedIndex = 0;
                }
                catch (Exception ee)
                {
                    MessageBox.Show("The following error has occured:\r\n" + ee.ToString());
                    if (gotData == true)
                    {
                        uxComboBox.SelectedIndex = 0;
                    }
                }

            }
        }