Beispiel #1
0
        // Token: 0x06000962 RID: 2402 RVA: 0x00020E34 File Offset: 0x0001F034
        internal bool ConvertAndMatch(object state)
        {
            object obj  = this.Value;
            string text = obj as string;
            Type   type = (state != null) ? state.GetType() : null;

            if (text != null && type != null && type != typeof(string))
            {
                BindingValueCache bindingValueCache = this.BindingValueCache;
                Type   bindingValueType             = bindingValueCache.BindingValueType;
                object obj2 = bindingValueCache.ValueAsBindingValueType;
                if (type != bindingValueType)
                {
                    obj2 = obj;
                    TypeConverter converter = DefaultValueConverter.GetConverter(type);
                    if (converter != null && converter.CanConvertFrom(typeof(string)))
                    {
                        try
                        {
                            obj2 = converter.ConvertFromString(null, TypeConverterHelper.InvariantEnglishUS, text);
                        }
                        catch (Exception ex)
                        {
                            if (CriticalExceptions.IsCriticalApplicationException(ex))
                            {
                                throw;
                            }
                        }
                        catch
                        {
                        }
                    }
                    bindingValueCache      = new BindingValueCache(type, obj2);
                    this.BindingValueCache = bindingValueCache;
                }
                obj = obj2;
            }
            return(this.Match(state, obj));
        }