Пример #1
0
        public static List <IField> ParseFieldsData(JObject fieldsData, CancellationToken cancelToken)
        {
            if (fieldsData == null)
            {
                throw new ArgumentNullException();
            }

            var fields = new List <IField>();

            IList <string> propertyNames = fieldsData.Properties().Select(p => p.Name).ToList();


            foreach (string fieldId in propertyNames)
            {
                cancelToken.ThrowIfCancellationRequested();

                JObject fieldData = (JObject)fieldsData.GetValue(fieldId);
                var     name      = (string)fieldData.GetValue("Name");
                var     type      = (string)fieldData.GetValue("Type");
                var     value     = (string)fieldData.GetValue("Value");

                ScField newField = new ScField(fieldId, name, type, value);
                fields.Add(newField);
            }

            return(fields);
        }
    public static List<IField> ParseFieldsData(JObject fieldsData, CancellationToken cancelToken)
    {
      if (fieldsData == null)
      {
        throw new ArgumentNullException();
      }

      var fields = new List<IField>();

      IList<string> propertyNames = fieldsData.Properties().Select(p => p.Name).ToList();


      foreach (string fieldId in propertyNames)
      {
        cancelToken.ThrowIfCancellationRequested();

        JObject fieldData = (JObject)fieldsData.GetValue(fieldId);
        var name = (string)fieldData.GetValue("Name");
        var type = (string)fieldData.GetValue("Type");
        var value = (string)fieldData.GetValue("Value");

        ScField newField = new ScField(fieldId, name, type, value);
        fields.Add(newField);
      }

      return fields;
    }
        public static List <IField> ParseFieldsData(JObject fieldsData, CancellationToken cancelToken)
        {
            cancelToken.ThrowIfCancellationRequested();

            if (fieldsData == null)
            {
                throw new ArgumentNullException();
            }

            var fields = new List <IField>();

            foreach (var field in fieldsData)
            {
                string key   = field.Key;
                string value = field.Value.ToString();

                ScField newField = new ScField(key, value);
                fields.Add(newField);
            }

            return(fields);
        }