コード例 #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
ファイル: RuntimeFormatter.cs プロジェクト: noahfalk/dnx
 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
ファイル: RuntimeFormatter.cs プロジェクト: noahfalk/dnx
 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;
 }