} // End of ImpConvertToType (...) protected virtual Object ImpConvertToType(Object sourceValue, Type targetType) { String oldCnvStrValue = null; IConvertibleString stringConverter = null; if (sourceValue == null) { return(null); } if (targetType == null) { return(sourceValue); } if (ImplAdapter == null) { return(sourceValue); } if ((stringConverter = ImplAdapter.Converter) == null) { return(sourceValue); } oldCnvStrValue = stringConverter.StringValue; try { stringConverter.StringValue = sourceValue.ToString(); return(stringConverter.ToType(targetType, null)); } finally { stringConverter.StringValue = oldCnvStrValue; } } // End of ImpConvertToType (...)
//protected virtual Object ImpConvertToType ( IConvertible converter, Type targetType ) //{ // if ( converter == null ) return null; // if ( targetType == null ) return null; // return converter.ToType ( targetType, null ); //} // End of ImpConvertToType (...) protected virtual Object ImpConvertToType(IConvertibleString stringConverter, Type targetType) { if (stringConverter == null) { return(null); } if (targetType == null) { return(null); } return(stringConverter.ToType(targetType, null)); } // End of ImpConvertToType (...)
public SymbolTableAdapter(IConvertibleString converter) { __converter = converter; }
protected virtual Boolean ImplDeserializeItem <ContextType> ( out Object retVal, Object item, Func <IValueItemBase> getCurrentContextDlg, ContextType context) where ContextType : ISerializationContext { retVal = null; //Type itemType = null; //NumericStringValue numericString = null; IConvertibleString cnvStr = null; ISerializable <IValueUnit> serMgr = null; ValueDomObjectSerializationManagerCollection serMgrColl = null; ObjectSerializationManagerDescr serMgrDescr = null; IValueUnit subCtxtLvl = null; IValueUnit subUnit = null; String typeName = null; IValueItem valueItem = null; if (item == null) { retVal = null; } else if (ImplIsBuiltinType(item.GetType())) { retVal = item; } //else if ( ImplIsString ( item.GetType () ) ) // if ( (itemType = ImplGetItemType ( context )) == null ) // retVal = item; // else if ( itemType == typeof ( String ) ) // retVal = item; // else // retVal = ImpConvertToType ( item, itemType ); //else if ( (numericString = item as NumericStringValue) != null ) // retVal = ImpConvertToType ( numericString, ImplGetItemType ( context ) ); else if (ImplIsString(item.GetType())) { retVal = ImpConvertToType(item, ImplGetItemType(context)); } else if ((cnvStr = item as IConvertibleString) != null) { retVal = ImpConvertToType(cnvStr, ImplGetItemType(context)); } else if ((subUnit = item as IValueUnit) == null) { return(false); } //propValue = pd.GetValue ( InitDto ); //if ( _DeserializeEnumerable ( ref propValue, pd, valueItem.Value, context ) ) // continue; //else // propValue = valueItem.Value; else if (getCurrentContextDlg == null) { return(false); } else if ((subCtxtLvl = getCurrentContextDlg() as IValueUnit) == null) { return(false); } else if ((valueItem = subCtxtLvl ["SerializationManager"] as IValueItem) == null) { return(false); } else if (valueItem.Value == null) { return(false); } else if ((typeName = valueItem.Value.ToString()) == null) { return(false); } else if ((serMgrColl = ValueDomObjectSerializationManagerCollection.Singleton) == null) { return(false); } else if ((serMgrDescr = serMgrColl [typeName]) == null) { return(false); } else if ((serMgr = serMgrDescr.SerializationManager) == null) { return(false); } else { retVal = serMgr.Deserialize(subUnit, context); } return(true); } // End of ImplDeserializeItem (...)
public ValueDomAdapter(IConvertibleString converter) : base(converter) { }