/// <summary>
        /// Reads the data for this import from the file specified.
        /// </summary>
        /// <param name="filename">The file to read from.</param>
        /// <param name="errorMessage">The error message if unsuccessful.</param>
        /// <returns>True if read successfully, false otherwise.</returns>
        public override bool ReadFromFile(string filename, out string errorMessage)
        {
            _partiesProvider = new PartiesProvider();
            errorMessage     = string.Empty;

            // Try to deserialize the file into the party notes.
            List <PartyNote> partyNotes = new List <PartyNote>();

            try
            {
                using (StreamReader sr = new StreamReader(filename, Encoding.Default))
                {
                    CsvReader csv = new CsvReader(sr, CultureInfo.CurrentCulture);

                    bool foundStartDataTag = false;
                    while (csv.Read())
                    {
                        // Get the first field.
                        string fullName = csv.GetField <string>(0);

                        // Ignore empty entries.
                        if (string.IsNullOrWhiteSpace(fullName))
                        {
                            continue;
                        }

                        // If haven't found the header line see if this is it
                        if (!foundStartDataTag)
                        {
                            if (fullName.Contains(DataStartTag))
                            {
                                foundStartDataTag = true;
                            }

                            continue;
                        }

                        // if here on a line with data after the start tag has been found so get the abbreviation
                        string abbreviation = csv.GetField <string>(1);

                        if (!string.IsNullOrWhiteSpace(abbreviation))
                        {
                            partyNotes.Add(new PartyNote {
                                FullName = fullName, Abbreviation = abbreviation
                            });
                        }
                    }
                }
            }
            catch (Exception e)
            {
                errorMessage = e.ToString();
                return(false);
            }

            if (partyNotes.Any())
            {
                _partiesProvider = new PartiesProvider(partyNotes);
            }

            return(true);
        }
 /// <summary>
 /// Loads the party notes from a file.
 /// </summary>
 /// <param name="resultsDir">The full path of the the results files.</param>
 /// <param name="fileName">The full path of the notes notes file, or null if the default is to be read.</param>
 public NotesFileParser(string resultsDir, string fileName = null)
 {
     _partiesProvider = new PartiesProvider();
     Parse(resultsDir, fileName);
 }