Ejemplo n.º 1
0
        private static object FetchAssocParam(ResultBuffer rb, string tag)
        {
            if (rb == null)
            {
                return(null);
            }
            if (string.IsNullOrEmpty(tag))
            {
                return(null);
            }
            Dictionary <string, object> dictionary = LspUtil.BuildAssocDictionary(rb);

            dictionary.Keys.Any((string key) => key.Equals("key", StringComparison.InvariantCultureIgnoreCase));
            if (!dictionary.ContainsKey(tag))
            {
                return(null);
            }
            object obj = dictionary[tag];

            if (obj == null)
            {
                return(null);
            }
            return(obj);
        }
Ejemplo n.º 2
0
        public object ESRI_SetFeatureClassAttributes(ResultBuffer rb)
        {
            object result;

            try
            {
                TypedValue[] array = rb.AsArray();
                if (array.Count <TypedValue>() < 3)
                {
                    result = null;
                }
                else
                {
                    TypedValue typedValue = array[0];
                    if (typedValue.TypeCode != 5006)
                    {
                        result = null;
                    }
                    else
                    {
                        ObjectId   id          = (ObjectId)typedValue.Value;
                        TypedValue typedValue2 = array[1];
                        if (typedValue2.TypeCode != 5005)
                        {
                            result = null;
                        }
                        else
                        {
                            string          name         = typedValue2.Value.ToString();
                            MSCFeatureClass featureClass = this.GetFeatureClass(name, null);
                            if (featureClass == null)
                            {
                                result = null;
                            }
                            else
                            {
                                Dictionary <string, object> dictionary = LspUtil.BuildAssocDictionary(rb);
                                if (dictionary.Count == 0)
                                {
                                    result = null;
                                }
                                else
                                {
                                    List <CadField> list = new List <CadField>();
                                    foreach (KeyValuePair <string, object> current in dictionary)
                                    {
                                        CadField cadField = this.CreateAttributeValue(featureClass, current.Key, current.Value);
                                        if (cadField != null)
                                        {
                                            list.Add(cadField);
                                        }
                                    }
                                    if (list.Count == 0)
                                    {
                                        result = null;
                                    }
                                    else
                                    {
                                        result = CadField.AddCadAttributesToEntity(id, list);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }