public RuntimeFile ReadRuntimeFile(JToken json) { var file = new RuntimeFile(); foreach (var runtimeSpec in EachProperty(json["runtimes"]).Select(ReadRuntimeSpec)) { file.Runtimes.Add(runtimeSpec.Name, runtimeSpec); } return file; }
private void WriteRuntimeFile(JObject json, RuntimeFile runtimeFile) { var runtimes = new JObject(); json["runtimes"] = runtimes; foreach (var x in runtimeFile.Runtimes.Values) { WriteRuntimeSpec(runtimes, x); } }
public RuntimeFile ReadRuntimeFile(JToken json) { var file = new RuntimeFile(); foreach (var runtimeSpec in EachProperty(json["runtimes"]).Select(ReadRuntimeSpec)) { file.Runtimes.Add(runtimeSpec.Name, runtimeSpec); } return(file); }
public void WriteRuntimeFile(string filePath, RuntimeFile runtimeFile) { using (var fileStream = new FileStream(filePath, FileMode.Create)) { using (var textWriter = new StreamWriter(fileStream)) { using (var jsonWriter = new JsonTextWriter(textWriter)) { jsonWriter.Formatting = Formatting.Indented; var json = new JObject(); WriteRuntimeFile(json, runtimeFile); json.WriteTo(jsonWriter); } } } }
private void WriteRuntimeFile(JObject json, RuntimeFile runtimeFile) { var runtimes = new JObject(); json["runtimes"] = runtimes; foreach(var x in runtimeFile.Runtimes.Values) { WriteRuntimeSpec(runtimes, x); } }