예제 #1
0
 // Token: 0x060011D9 RID: 4569 RVA: 0x00062984 File Offset: 0x00060B84
 public JsonSchemaNode(JsonSchema schema)
 {
     this.Schemas = new ReadOnlyCollection <JsonSchema>(new JsonSchema[]
     {
         schema
     });
     this.Properties        = new Dictionary <string, JsonSchemaNode>();
     this.PatternProperties = new Dictionary <string, JsonSchemaNode>();
     this.Items             = new List <JsonSchemaNode>();
     this.Id = JsonSchemaNode.GetId(this.Schemas);
 }
예제 #2
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);

            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.AdditionalProperties != null)
            {
                AddAdditionalProperties(currentNode, schema.AdditionalProperties);
            }

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

            return(currentNode);
        }
 private JsonSchemaNode(JsonSchemaNode source, JsonSchema schema)
 {
     this.Schemas = new ReadOnlyCollection <JsonSchema>(Enumerable.ToList <JsonSchema>(Enumerable.Union <JsonSchema>(source.Schemas, new JsonSchema[]
     {
         schema
     })));
     this.Properties           = new Dictionary <string, JsonSchemaNode>(source.Properties);
     this.PatternProperties    = new Dictionary <string, JsonSchemaNode>(source.PatternProperties);
     this.Items                = new List <JsonSchemaNode>(source.Items);
     this.AdditionalProperties = source.AdditionalProperties;
     this.Id = JsonSchemaNode.GetId(this.Schemas);
 }
예제 #4
0
 private JsonSchemaNode(JsonSchemaNode source, JsonSchema schema)
 {
     Class6.yDnXvgqzyB5jw();
     base();
     this.Schemas              = new ReadOnlyCollection <JsonSchema>(source.Schemas.Union <JsonSchema>((IEnumerable <JsonSchema>)(new JsonSchema[] { schema })).ToList <JsonSchema>());
     this.Properties           = new Dictionary <string, JsonSchemaNode>(source.Properties);
     this.PatternProperties    = new Dictionary <string, JsonSchemaNode>(source.PatternProperties);
     this.Items                = new List <JsonSchemaNode>(source.Items);
     this.AdditionalProperties = source.AdditionalProperties;
     this.AdditionalItems      = source.AdditionalItems;
     this.Id = JsonSchemaNode.GetId(this.Schemas);
 }
예제 #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);
        }
예제 #6
0
        public JsonSchemaNode AddSchema(JsonSchemaNode existingNode, JsonSchema schema)
        {
            string id;

            if (existingNode == null)
            {
                id = JsonSchemaNode.GetId((IEnumerable <JsonSchema>)(new JsonSchema[] { schema }));
            }
            else
            {
                if (existingNode.Schemas.Contains(schema))
                {
                    return(existingNode);
                }
                id = JsonSchemaNode.GetId(existingNode.Schemas.Union <JsonSchema>((IEnumerable <JsonSchema>)(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 extend in schema.Extends)
                {
                    jsonSchemaNode = this.AddSchema(jsonSchemaNode, extend);
                }
            }
            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);
        }
예제 #8
0
        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[1]
                {
                    schema
                }));
            }
            else
            {
                id = JsonSchemaNode.GetId(new JsonSchema[1]
                {
                    schema
                });
            }
            if (_nodes.Contains(id))
            {
                return(_nodes[id]);
            }
            JsonSchemaNode jsonSchemaNode = (existingNode == null) ? new JsonSchemaNode(schema) : existingNode.Combine(schema);

            _nodes.Add(jsonSchemaNode);
            AddProperties(schema.Properties, jsonSchemaNode.Properties);
            AddProperties(schema.PatternProperties, jsonSchemaNode.PatternProperties);
            if (schema.Items != null)
            {
                for (int i = 0; i < schema.Items.Count; i++)
                {
                    AddItem(jsonSchemaNode, i, schema.Items[i]);
                }
            }
            if (schema.AdditionalProperties != null)
            {
                AddAdditionalProperties(jsonSchemaNode, schema.AdditionalProperties);
            }
            if (schema.Extends != null)
            {
                jsonSchemaNode = AddSchema(jsonSchemaNode, schema.Extends);
            }
            return(jsonSchemaNode);
        }
예제 #9
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);
        }