internal override bool TryParseMemberAndAdd(string memberName, JToken parseInformation)
        {
            PropertyInfo property = this.GetType().GetRuntimeProperty(memberName.ToCamelCase());

            if (property == null)
            {
                return(false);
            }

            var extraTranslations = new ExtraTranslation[parseInformation.Count()];

            for (int i = 0; i < parseInformation.Count(); i++)
            {
                extraTranslations[i] = new ExtraTranslation(
                    (string)parseInformation[i][0], parseInformation[i][1].ToObject <string[]>());
            }

            property.SetMethod.Invoke(this,
                                      new object[] { extraTranslations });

            return(true);
        }
示例#2
0
        internal override bool TryParseMemberAndAdd(string memberName, JsonElement parseInformation)
        {
            PropertyInfo property = this.GetType().GetRuntimeProperty(memberName.ToCamelCase());

            if (property == null)
            {
                return(false);
            }

            var extraTranslations = new ExtraTranslation[parseInformation.GetArrayLength()];

            for (int i = 0; i < parseInformation.GetArrayLength(); i++)
            {
                extraTranslations[i] = new ExtraTranslation(
                    parseInformation[i][0].GetString(),
                    Array.ConvertAll(parseInformation[i][1].EnumerateArray().ToArray(), x => x.GetString()));
            }

            property.SetMethod.Invoke(this,
                                      new object[] { extraTranslations });

            return(true);
        }