Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
 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);
     }
 }
Пример #4
0
 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;
 }