private void WriteRuntimeSpec(JObject json, RuntimeSpec data) { var value = new JObject(); json[data.Name] = value; value["#import"] = new JArray(data.Import.Select(x => new JValue(x))); foreach (var x in data.Dependencies.Values) { WriteDependencySpec(value, x); } }
private RuntimeSpec ReadRuntimeSpec(KeyValuePair <string, JToken> json) { var runtime = new RuntimeSpec(); runtime.Name = json.Key; foreach (var property in EachProperty(json.Value)) { if (property.Key == "#import") { var imports = property.Value as JArray; foreach (var import in imports) { runtime.Import.Add(import.Value <string>()); } } else { var dependency = ReadDependencySpec(property); runtime.Dependencies.Add(dependency.Name, dependency); } } return(runtime); }
private RuntimeSpec ReadRuntimeSpec(KeyValuePair<string, JToken> json) { var runtime = new RuntimeSpec(); runtime.Name = json.Key; foreach (var property in EachProperty(json.Value)) { if (property.Key == "#import") { var imports = property.Value as JArray; foreach (var import in imports) { runtime.Import.Add(import.Value<string>()); } } else { var dependency = ReadDependencySpec(property); runtime.Dependencies.Add(dependency.Name, dependency); } } return runtime; }