Esempio n. 1
0
        private static IEnumerable<TLCombinator> CreateCombinatorsFromJsonArrayObjects(JsonArrayObjects objects, string nameKey, TLTypesBox typesBox)
        {
            return
                objects.ConvertAll(
                    x =>
                        new TLCombinator(x.Get(nameKey))
                        {
                            Number = (uint) x.JsonTo<int>("id"),
                            Parameters =
                                x.ArrayObjects("params")
								.ConvertAll(param => new TLCombinatorParameter(param.Get("name"),param.Get("type")) {Type = typesBox[param.Get("type")]}),
                            Type = typesBox[x.Get("type")]
                        }).Where(combinator => !HasBuiltInSerializer(combinator.Number)).ToList();
        }
Esempio n. 2
0
 private List <TLCombinator> CreateCombinatorsFromJsonArrayObjects(JsonArrayObjects objects, string nameKey)
 {
     return
         (objects.ConvertAll(
              x =>
              new TLCombinator(x.Get(nameKey))
     {
         Number = (uint)x.JsonTo <int>("id"),
         Parameters = x.ArrayObjects("params").ConvertAll(param => new TLCombinatorParameter(param.Get("name"))
         {
             Type = GetTLType(param.Get("type"))
         }),
         Type = GetTLType(x.Get("type"))
     }).Where(combinator => !HasBuiltInSerializer(combinator.Number)).ToList());
 }
        private static IEnumerable <object> ParseAllowedValues(JsonArrayObjects json, FieldSchema schema)
        {
            if (json == null)
            {
                return(null);
            }

            if (json.Count == 0)
            {
                return(new object[0]);
            }

            var parser = GetParserFor(schema);

            if (parser != null)
            {
                return(json.ConvertAll(parser.Invoke));
            }

            // Fallback to returning an array of JsonObjects
            return(json);
        }
        private static IEnumerable<object> ParseAllowedValues(JsonArrayObjects json, FieldSchema schema)
        {
            if (json == null)
            {
                return null;
            }

            if (json.Count == 0)
            {
                return new object[0];
            }

            var parser = GetParserFor(schema);
            if (parser != null)
            {
                return json.ConvertAll(parser.Invoke);
            }

            // Fallback to returning an array of JsonObjects
            return json;
        }