public static void WriteToFile(Options options, SolutionAnalysis solutionAnalysis) { using var fileStream = File.Create(GetAnalysisFilePath(options)); using var jsonTextWriter = new Utf8JsonWriter(fileStream); jsonTextWriter.WriteStartObject(); jsonTextWriter.WriteStatus(solutionAnalysis.Status); jsonTextWriter.WriteComments(solutionAnalysis.Comments); jsonTextWriter.WriteEndObject(); }
public static void Write(SolutionAnalysis solutionAnalysis) { Log.Information("Writing analyzed solution to analysis file."); using (var fileWriter = File.CreateText(solutionAnalysis.Solution.Paths.AnalysisFilePath)) using (var jsonTextWriter = new JsonTextWriter(fileWriter)) { jsonTextWriter.WriteStartObject(); jsonTextWriter.WritePropertyName("status"); jsonTextWriter.WriteValue(solutionAnalysis.Result.Status.ToString().Underscore()); jsonTextWriter.WritePropertyName("comments"); jsonTextWriter.WriteStartArray(); jsonTextWriter.WriteValues(solutionAnalysis.Result.Comments); jsonTextWriter.WriteEndArray(); jsonTextWriter.WriteEndObject(); } }