public IList <DailyCodeChurn> ParseFile(string fileName) { var stream = streamFactory.readFile(fileName); var serializer = JsonSerializer.Create(); var jsonReader = new JsonTextReader(new StreamReader(stream)); using (stream) { var content = serializer.Deserialize <JsonOutputData>(jsonReader); if (content.SchemaVersion == OutputProcessor.SchemaVersion) { return(content.Data); } throw new Exception($"Version mismatch. Expecting {OutputProcessor.SchemaVersion} found {content.SchemaVersion}"); } }
public IList <T> ParseFile(string fileName) { var stream = streamFactory.readFile(fileName); var serializer = JsonSerializer.Create(); serializer.Converters.Add(new JsonDateTimeCustomConverter(DailyCodeChurn.DATE_FORMAT, CultureInfo.InvariantCulture)); var jsonReader = new JsonTextReader(new StreamReader(stream)); using (stream) { var content = serializer.Deserialize <JsonOutputData <T> >(jsonReader); if (content.SchemaVersion == JsonOutputData <T> .CurrentVersion) { return(content.Data); } throw new Exception($"Version mismatch. Expecting {JsonOutputData<T>.CurrentVersion} found {content.SchemaVersion} in {fileName}"); } }