Beispiel #1
0
        public static ObjectId GetArgument(ResultBuffer rb, int index, ObjectId defaultValue)
        {
            ObjectId result;

            try
            {
                if (rb == null)
                {
                    result = defaultValue;
                }
                else
                {
                    TypedValue[] array = rb.AsArray();
                    if (array.Count <TypedValue>() < index + 1)
                    {
                        result = defaultValue;
                    }
                    else
                    {
                        object typedValue = LspUtil.GetTypedValue(array[index]);
                        if (typedValue is ObjectId)
                        {
                            result = (ObjectId)typedValue;
                        }
                        else
                        {
                            result = defaultValue;
                        }
                    }
                }
            }
            catch
            {
                result = defaultValue;
            }
            return(result);
        }