internal void Load(Stream stream)
        {
            JsonConfigurationFileParser parser = new JsonConfigurationFileParser();
            try
            {
                Data = parser.Parse(stream);
            }
            catch(JsonReaderException e)
            {
                string errorLine = string.Empty;
                if (File.Exists(Path))
                {
                    // Read the JSON file and get the line content where the error occurred.
                    List<string> fileContent;
                    if (e.LineNumber > 1)
                    {
                        fileContent = File.ReadLines(Path).Skip(e.LineNumber - 2).Take(2).ToList();
                        errorLine = fileContent[0].Trim() + Environment.NewLine + fileContent[1].Trim();
                    }
                    else
                    {
                        fileContent = File.ReadLines(Path).Skip(e.LineNumber - 1).Take(1).ToList();
                        errorLine = fileContent[0].Trim();
                    }
                }

                throw new FormatException(Resources.FormatError_JSONParseError(e.LineNumber, errorLine), e);
            }
        }
 /// <summary>
 /// Loads the JSON data from a stream.
 /// </summary>
 /// <param name="stream">The stream to read.</param>
 public override void Load(Stream stream)
 {
     try {
         Data = JsonConfigurationFileParser.Parse(stream);
     } catch (JsonReaderException e)
     {
         throw new FormatException(Resources.Error_JSONParseError, e);
     }
 }
        /// <summary>
        /// Loads the JSON data from a stream.
        /// </summary>
        /// <param name="stream">The stream to read.</param>
        public override void Load(Stream stream)
        {
            try
            {
                Data = JsonConfigurationFileParser.Parse(stream);
            }
            catch (JsonReaderException e)
            {
                string errorLine = string.Empty;
                if (stream.CanSeek)
                {
                    stream.Seek(0, SeekOrigin.Begin);

                    IEnumerable <string> fileContent;
                    using (var streamReader = new StreamReader(stream))
                    {
                        fileContent = ReadLines(streamReader);
                        errorLine   = RetrieveErrorContext(e, fileContent);
                    }
                }

                throw new FormatException("");
            }
        }
 /// <summary>
 /// Loads json configuration key/values from a stream into a provider.
 /// </summary>
 /// <param name="stream">The json <see cref="Stream"/> to load configuration data from.</param>
 public override void Load(Stream stream)
 {
     Data = JsonConfigurationFileParser.Parse(stream);
 }