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));
        }
Beispiel #2
0
 public T ConvertValue <T>(object value)
 {
     return(DefaultValueConverter.ConvertValue <T>(value));
 }
Beispiel #3
0
 internal virtual void RegisterType(Type javaClass, DefaultValueConverter toNeo)
 {
     _javaToNeo[javaClass] = toNeo;
 }
Beispiel #4
0
 private static DefaultValueConverter ToList(DefaultValueConverter inner, Type type)
 {
     return(new DefaultValueConverter(NTList(inner.Type()), typeof(System.Collections.IList), new ListConverter(type, inner.Type())));
 }
Beispiel #5
0
 public void Init()
 {
     _sut = new DefaultValueConverter();
 }