public override T[] ParseFile(string filePath)
        {
            var values = new List <T>();

            var fullFilePath = Path.GetFullPath(filePath);

            using (var reader = new StreamReader(File.OpenRead(fullFilePath)))
            {
                var context = new FileLineContext(fullFilePath);

                while (!reader.EndOfStream)
                {
                    context.SetNextLine(reader.ReadLine());

                    try
                    {
                        var result = ParseLine(context);

                        if (!result.SkipLine)
                        {
                            values.Add(result.Value);
                        }
                    }
                    catch (Exception ex)
                    {
                        var pex = new FileLineParseException(context, ex.Message, ex);
                        WriteError(pex);
                        throw pex;
                    }
                }
            }

            return(values.ToArray());
        }
 protected abstract FileLineParseResult <T> ParseLine(FileLineContext context);
 internal FileLineParseException(FileLineContext context, string errorMessage, Exception innerException)
     : base(string.Format("Error parsing line {0} of file '{1}': {2}", context.LineNumber, context.FilePath, errorMessage), innerException)
 {
     Context = context;
 }