public static void WriteRuntimeGraph(string filePath, RuntimeGraph runtimeGraph) { using (var fileStream = new FileStream(filePath, FileMode.Create)) using (var textWriter = new StreamWriter(fileStream)) using (var jsonWriter = new JsonTextWriter(textWriter)) using (var writer = new JsonObjectWriter(jsonWriter)) { jsonWriter.Formatting = Formatting.Indented; WriteRuntimeGraph(writer, runtimeGraph); } }
public static void WriteRuntimeGraph(JObject jObject, RuntimeGraph runtimeGraph) { if (runtimeGraph.Runtimes.Any()) { var runtimes = new JObject(); jObject["runtimes"] = runtimes; foreach (var x in runtimeGraph.Runtimes.Values) { WriteRuntimeDescription(runtimes, x); } } if (runtimeGraph.Supports.Any()) { var supports = new JObject(); jObject["supports"] = supports; foreach (var x in runtimeGraph.Supports.Values) { WriteCompatibilityProfile(supports, x); } } }