public JsonSchemaNode AddSchema(JsonSchemaNode existingNode, JsonSchema schema)
        {
            string newId;

            if (existingNode != null)
            {
                if (existingNode.Schemas.Contains(schema))
                {
                    return(existingNode);
                }

                newId = JsonSchemaNode.GetId(existingNode.Schemas.Union(new[] { schema }));
            }
            else
            {
                newId = JsonSchemaNode.GetId(new[] { schema });
            }

            if (_nodes.Contains(newId))
            {
                return(_nodes[newId]);
            }

            JsonSchemaNode currentNode =
                (existingNode != null) ? existingNode.Combine(schema) : new JsonSchemaNode(schema);

            _nodes.Add(currentNode);

            AddProperties(schema.Properties, currentNode.Properties);

            AddProperties(schema.PatternProperties, currentNode.PatternProperties);

            if (schema.Items != null)
            {
                for (int i = 0; i < schema.Items.Count; i++)
                {
                    AddItem(currentNode, i, schema.Items[i]);
                }
            }

            if (schema.AdditionalItems != null)
            {
                AddAdditionalItems(currentNode, schema.AdditionalItems);
            }

            if (schema.AdditionalProperties != null)
            {
                AddAdditionalProperties(currentNode, schema.AdditionalProperties);
            }

            if (schema.Extends != null)
            {
                foreach (JsonSchema jsonSchema in schema.Extends)
                {
                    currentNode = AddSchema(currentNode, jsonSchema);
                }
            }

            return(currentNode);
        }
        public JsonSchemaNode AddSchema(JsonSchemaNode existingNode, JsonSchema schema)
        {
            string newId;
            if (existingNode != null)
            {
                if (existingNode.Schemas.Contains(schema))
                {
                    return existingNode;
                }

                newId = JsonSchemaNode.GetId(existingNode.Schemas.Union(new[] { schema }));
            }
            else
            {
                newId = JsonSchemaNode.GetId(new[] { schema });
            }

            if (_nodes.Contains(newId))
            {
                return _nodes[newId];
            }

            JsonSchemaNode currentNode = (existingNode != null)
                ? existingNode.Combine(schema)
                : new JsonSchemaNode(schema);

            _nodes.Add(currentNode);

            AddProperties(schema.Properties, currentNode.Properties);

            AddProperties(schema.PatternProperties, currentNode.PatternProperties);

            if (schema.Items != null)
            {
                for (int i = 0; i < schema.Items.Count; i++)
                {
                    AddItem(currentNode, i, schema.Items[i]);
                }
            }

            if (schema.AdditionalItems != null)
            {
                AddAdditionalItems(currentNode, schema.AdditionalItems);
            }

            if (schema.AdditionalProperties != null)
            {
                AddAdditionalProperties(currentNode, schema.AdditionalProperties);
            }

            if (schema.Extends != null)
            {
                foreach (JsonSchema jsonSchema in schema.Extends)
                {
                    currentNode = AddSchema(currentNode, jsonSchema);
                }
            }

            return currentNode;
        }
Ejemplo n.º 3
0
 public JsonSchemaNode AddSchema(JsonSchemaNode existingNode, JsonSchema schema)
 {
   string id;
   if (existingNode != null)
   {
     if (existingNode.Schemas.Contains(schema))
       return existingNode;
     id = JsonSchemaNode.GetId(Enumerable.Union<JsonSchema>((IEnumerable<JsonSchema>) existingNode.Schemas, (IEnumerable<JsonSchema>) new JsonSchema[1]
     {
       schema
     }));
   }
   else
     id = JsonSchemaNode.GetId((IEnumerable<JsonSchema>) new JsonSchema[1]
     {
       schema
     });
   if (this._nodes.Contains(id))
     return this._nodes[id];
   JsonSchemaNode jsonSchemaNode = existingNode != null ? existingNode.Combine(schema) : new JsonSchemaNode(schema);
   this._nodes.Add(jsonSchemaNode);
   this.AddProperties(schema.Properties, (IDictionary<string, JsonSchemaNode>) jsonSchemaNode.Properties);
   this.AddProperties(schema.PatternProperties, (IDictionary<string, JsonSchemaNode>) jsonSchemaNode.PatternProperties);
   if (schema.Items != null)
   {
     for (int index = 0; index < schema.Items.Count; ++index)
       this.AddItem(jsonSchemaNode, index, schema.Items[index]);
   }
   if (schema.AdditionalProperties != null)
     this.AddAdditionalProperties(jsonSchemaNode, schema.AdditionalProperties);
   if (schema.Extends != null)
     jsonSchemaNode = this.AddSchema(jsonSchemaNode, schema.Extends);
   return jsonSchemaNode;
 }
Ejemplo n.º 4
0
        // Token: 0x060011C8 RID: 4552 RVA: 0x00062490 File Offset: 0x00060690
        public JsonSchemaNode AddSchema(JsonSchemaNode existingNode, JsonSchema schema)
        {
            string id;

            if (existingNode != null)
            {
                if (existingNode.Schemas.Contains(schema))
                {
                    return(existingNode);
                }
                id = JsonSchemaNode.GetId(existingNode.Schemas.Union(new JsonSchema[]
                {
                    schema
                }));
            }
            else
            {
                id = JsonSchemaNode.GetId(new JsonSchema[]
                {
                    schema
                });
            }
            if (this._nodes.Contains(id))
            {
                return(this._nodes[id]);
            }
            JsonSchemaNode jsonSchemaNode = (existingNode != null) ? existingNode.Combine(schema) : new JsonSchemaNode(schema);

            this._nodes.Add(jsonSchemaNode);
            this.AddProperties(schema.Properties, jsonSchemaNode.Properties);
            this.AddProperties(schema.PatternProperties, jsonSchemaNode.PatternProperties);
            if (schema.Items != null)
            {
                for (int i = 0; i < schema.Items.Count; i++)
                {
                    this.AddItem(jsonSchemaNode, i, schema.Items[i]);
                }
            }
            if (schema.AdditionalItems != null)
            {
                this.AddAdditionalItems(jsonSchemaNode, schema.AdditionalItems);
            }
            if (schema.AdditionalProperties != null)
            {
                this.AddAdditionalProperties(jsonSchemaNode, schema.AdditionalProperties);
            }
            if (schema.Extends != null)
            {
                foreach (JsonSchema schema2 in schema.Extends)
                {
                    jsonSchemaNode = this.AddSchema(jsonSchemaNode, schema2);
                }
            }
            return(jsonSchemaNode);
        }
Ejemplo n.º 5
0
        public JsonSchemaNode AddSchema(JsonSchemaNode existingNode, JsonSchema schema)
        {
            string id;

            if (existingNode != null)
            {
                if (existingNode.Schemas.Contains(schema))
                {
                    return(existingNode);
                }
                JsonSchema[] second = new JsonSchema[] { schema };
                id = JsonSchemaNode.GetId(existingNode.Schemas.Union <JsonSchema>(second));
            }
            else
            {
                JsonSchema[] schemata = new JsonSchema[] { schema };
                id = JsonSchemaNode.GetId(schemata);
            }
            if (this._nodes.Contains(id))
            {
                return(this._nodes[id]);
            }
            JsonSchemaNode item = (existingNode != null) ? existingNode.Combine(schema) : new JsonSchemaNode(schema);

            this._nodes.Add(item);
            this.AddProperties(schema.Properties, item.Properties);
            this.AddProperties(schema.PatternProperties, item.PatternProperties);
            if (schema.Items != null)
            {
                for (int i = 0; i < schema.Items.Count; i++)
                {
                    this.AddItem(item, i, schema.Items[i]);
                }
            }
            if (schema.AdditionalItems != null)
            {
                this.AddAdditionalItems(item, schema.AdditionalItems);
            }
            if (schema.AdditionalProperties != null)
            {
                this.AddAdditionalProperties(item, schema.AdditionalProperties);
            }
            if (schema.Extends != null)
            {
                foreach (JsonSchema schema2 in schema.Extends)
                {
                    item = this.AddSchema(item, schema2);
                }
            }
            return(item);
        }
Ejemplo n.º 6
0
    public JsonSchemaNode AddSchema(JsonSchemaNode existingNode, JsonSchema schema)
    {
      string newId;
      if (existingNode != null)
      {
        if (existingNode.Schemas.Contains(schema))
          return existingNode;

        newId = JsonSchemaNode.GetId(existingNode.Schemas.Union(new[] { schema }));
      }
      else
      {
        newId = JsonSchemaNode.GetId(new[] { schema });
      }

      if (_nodes.Contains(newId))
        return _nodes[newId];

      JsonSchemaNode currentNode = (existingNode != null)
        ? existingNode.Combine(schema)
        : new JsonSchemaNode(schema);

      _nodes.Add(currentNode);

      if (schema.Properties != null)
      {
        foreach (KeyValuePair<string, JsonSchema> property in schema.Properties)
        {
          AddProperty(currentNode, property.Key, property.Value);
        }
      }

      if (schema.Items != null)
      {
        for (int i = 0; i < schema.Items.Count; i++)
        {
          AddItem(currentNode, i, schema.Items[i]);
        }
      }

      if (schema.AdditionalProperties != null)
        AddAdditionalProperties(currentNode, schema.AdditionalProperties);

      if (schema.Extends != null)
        currentNode = AddSchema(currentNode, schema.Extends);

      return currentNode;
    }
Ejemplo n.º 7
0
        public JsonSchemaNode AddSchema(JsonSchemaNode existingNode, JsonSchema schema)
        {
            string id;

            if (existingNode != null)
            {
                if (existingNode.Schemas.Contains(schema))
                {
                    return(existingNode);
                }
                id = JsonSchemaNode.GetId(Enumerable.Union <JsonSchema>((IEnumerable <JsonSchema>)existingNode.Schemas, (IEnumerable <JsonSchema>) new JsonSchema[1]
                {
                    schema
                }));
            }
            else
            {
                id = JsonSchemaNode.GetId((IEnumerable <JsonSchema>) new JsonSchema[1]
                {
                    schema
                });
            }
            if (this._nodes.Contains(id))
            {
                return(this._nodes[id]);
            }
            JsonSchemaNode jsonSchemaNode = existingNode != null?existingNode.Combine(schema) : new JsonSchemaNode(schema);

            this._nodes.Add(jsonSchemaNode);
            this.AddProperties(schema.Properties, (IDictionary <string, JsonSchemaNode>)jsonSchemaNode.Properties);
            this.AddProperties(schema.PatternProperties, (IDictionary <string, JsonSchemaNode>)jsonSchemaNode.PatternProperties);
            if (schema.Items != null)
            {
                for (int index = 0; index < schema.Items.Count; ++index)
                {
                    this.AddItem(jsonSchemaNode, index, schema.Items[index]);
                }
            }
            if (schema.AdditionalProperties != null)
            {
                this.AddAdditionalProperties(jsonSchemaNode, schema.AdditionalProperties);
            }
            if (schema.Extends != null)
            {
                jsonSchemaNode = this.AddSchema(jsonSchemaNode, schema.Extends);
            }
            return(jsonSchemaNode);
        }
        public JsonSchemaNode AddSchema(JsonSchemaNode existingNode, JsonSchema schema)
        {
            string id;

            if (existingNode != null)
            {
                if (existingNode.Schemas.Contains(schema))
                {
                    return(existingNode);
                }
                id = JsonSchemaNode.GetId(Enumerable.Union <JsonSchema>(existingNode.Schemas, new JsonSchema[]
                {
                    schema
                }));
            }
            else
            {
                id = JsonSchemaNode.GetId(new JsonSchema[]
                {
                    schema
                });
            }
            if (this._nodes.Contains(id))
            {
                return(this._nodes.get_Item(id));
            }
            JsonSchemaNode jsonSchemaNode = (existingNode == null) ? new JsonSchemaNode(schema) : existingNode.Combine(schema);

            this._nodes.Add(jsonSchemaNode);
            this.AddProperties(schema.Properties, jsonSchemaNode.Properties);
            this.AddProperties(schema.PatternProperties, jsonSchemaNode.PatternProperties);
            if (schema.Items != null)
            {
                for (int i = 0; i < schema.Items.get_Count(); i++)
                {
                    this.AddItem(jsonSchemaNode, i, schema.Items.get_Item(i));
                }
            }
            if (schema.AdditionalProperties != null)
            {
                this.AddAdditionalProperties(jsonSchemaNode, schema.AdditionalProperties);
            }
            if (schema.Extends != null)
            {
                jsonSchemaNode = this.AddSchema(jsonSchemaNode, schema.Extends);
            }
            return(jsonSchemaNode);
        }
 // Token: 0x060009E5 RID: 2533
 // RVA: 0x0003EBE8 File Offset: 0x0003CDE8
 public JsonSchemaNode AddSchema(JsonSchemaNode existingNode, JsonSchema schema)
 {
     string id;
     if (existingNode != null)
     {
         if (existingNode.Schemas.Contains(schema))
         {
             return existingNode;
         }
         id = JsonSchemaNode.GetId(Enumerable.Union<JsonSchema>(existingNode.Schemas, new JsonSchema[]
         {
             schema
         }));
     }
     else
     {
         id = JsonSchemaNode.GetId(new JsonSchema[]
         {
             schema
         });
     }
     if (this._nodes.Contains(id))
     {
         return this._nodes[id];
     }
     JsonSchemaNode jsonSchemaNode = (existingNode != null) ? existingNode.Combine(schema) : new JsonSchemaNode(schema);
     this._nodes.Add(jsonSchemaNode);
     this.AddProperties(schema.Properties, jsonSchemaNode.Properties);
     this.AddProperties(schema.PatternProperties, jsonSchemaNode.PatternProperties);
     if (schema.Items != null)
     {
         for (int i = 0; i < schema.Items.Count; i++)
         {
             this.AddItem(jsonSchemaNode, i, schema.Items[i]);
         }
     }
     if (schema.AdditionalItems != null)
     {
         this.AddAdditionalItems(jsonSchemaNode, schema.AdditionalItems);
     }
     if (schema.AdditionalProperties != null)
     {
         this.AddAdditionalProperties(jsonSchemaNode, schema.AdditionalProperties);
     }
     if (schema.Extends != null)
     {
         foreach (JsonSchema current in schema.Extends)
         {
             jsonSchemaNode = this.AddSchema(jsonSchemaNode, current);
         }
     }
     return jsonSchemaNode;
 }