public static object DeserializeObject(char *chars, int length, Type type, JsonFormatterOptions options) { if ((options & JsonFormatterOptions.MultiReferencingReference) != 0) { var jsonDeserializer = new JsonReferenceDeserializer(chars, length); var result = ValueInterface.GetInterface(type).Read(jsonDeserializer); if (jsonDeserializer.references.Count != 0) { ReferenceInfo.ProcessReference(result, jsonDeserializer.references); if (jsonDeserializer.updateBase) { result = RWHelper.GetContent <object>(jsonDeserializer.writer); result = Convert.ChangeType(result, type); } } return(result); } return(DeserializeObject(chars, length, type)); }
public static object DeserializeObject(string text, Type type, JsonFormatterOptions options = JsonFormatterOptions.Default) { fixed(char *chars = text) { return(ValueInterface.GetInterface(type).ReadValue(new JsonDeserializer(chars, 0, text.Length, options))); } }
public object Deserialize(string text, Type type) { fixed(char *chars = text) { return(ValueInterface.GetInterface(type).ReadValue(new JsonDeserializer(chars, 0, text.Length, Options))); } }
public static object DeserializeObject(string text, Type type) { fixed(char *chars = text) { return(ValueInterface.GetInterface(type).Read(new JsonDeserializer(chars, 0, text.Length))); } }
static FSharpOptionInterface() { if (default(T) != null) { NullableInterface = ValueInterface.GetInterface(typeof(Nullable <>).MakeGenericType(typeof(T))); } }
private protected override void InitializeByRef(PropertyInfo propertyInfo, XBindingFlags flags) { base.InitializeByRef(propertyInfo, flags); _get = null; _set = null; @interface = ValueInterface.GetInterface(propertyInfo.PropertyType.GetElementType()); }
public object DirectRead() { try { return(ValueInterface.GetInterface(ReadType()).Read(this)); } catch { return(null); } }
object Deserialize <TMode>(byte *bytes, int length, Type type, MessagePackFormatterOptions options) where TMode : struct { var deserializer = new MessagePackDeserializer <TMode>(this, bytes, length, MaxDepth, options); if (typeof(TMode) == typeof(MessagePackDeserializeModes.ReferenceMode)) { deserializer.InitReferences(); } return(ValueInterface.GetInterface(type).Read(deserializer)); }
private protected override void InitializeByValue(PropertyInfo propertyInfo, XBindingFlags flags) { base.InitializeByValue(propertyInfo, flags); if (_get is null) { _get = propertyInfo.GetGetMethod((flags & XBindingFlags.NonPublic) != 0); } if (_set is null) { _set = propertyInfo.GetSetMethod((flags & XBindingFlags.NonPublic) != 0); } @interface = ValueInterface.GetInterface(propertyInfo.PropertyType); }
public static object DeserializeObject(char *chars, int length, Type type, JsonFormatterOptions options) { switch (options & ModeOptions) { case JsonFormatterOptions.MultiReferencingReference: return(ValueInterface.GetInterface(type).Read(new JsonDeserializer <JsonDeserializeModes.Reference>(chars, length))); case JsonFormatterOptions.DeflateDeserialize: return(ValueInterface.GetInterface(type).Read(new JsonDeserializer <JsonDeserializeModes.Deflate>(chars, length))); case JsonFormatterOptions.StandardDeserialize: return(ValueInterface.GetInterface(type).Read(new JsonDeserializer <JsonDeserializeModes.Standard>(chars, length))); default: return(ValueInterface.GetInterface(type).Read(new JsonDeserializer <DefaultDeserializeMode>(chars, length))); } }
public object Deserialize(string text, Type type) { var options = Options; var id = Id; fixed(char *chars = text) { if ((options & JsonFormatterOptions.MultiReferencingReference) != 0) { var jsonDeserializer = new JsonReferenceDeserializer(chars, 0, text.Length); if (id != 0) { jsonDeserializer.id = id; } var result = ValueInterface.GetInterface(type).Read(jsonDeserializer); if (jsonDeserializer.references.Count != 0) { ReferenceInfo.ProcessReference(result, jsonDeserializer.references); if (jsonDeserializer.updateBase) { result = RWHelper.GetContent <object>(jsonDeserializer.writer); result = Convert.ChangeType(result, type); } } return(result); } else { var jsonDeserializer = new JsonDeserializer(chars, 0, text.Length); if (id != 0) { jsonDeserializer.id = id; } return(ValueInterface.GetInterface(type).Read(jsonDeserializer)); } } }
/// <summary> /// 读取当前行的所有数据并进行筛选,然后将筛选结果写入器数据写入器中。 /// </summary> /// <param name="dataWriter">数据写入器</param> /// <param name="valueFilter">值筛选器</param> public void OnReadAll(IDataWriter <int> dataWriter, IValueFilter <int> valueFilter) { int length = dbDataReader.FieldCount; var valueInfo = new ValueFilterInfo <int>(); for (int i = 0; i < length; i++) { var value = dbDataReader[i]; ValueInterface.GetInterface(value).Write(valueInfo.ValueCopyer, value); valueInfo.Key = i; valueInfo.Type = dbDataReader.GetFieldType(i); if (valueFilter.Filter(valueInfo)) { valueInfo.ValueCopyer.WriteTo(dataWriter[valueInfo.Key]); } } }
/// <summary> /// 在数据写入器中写入该类型的实例。 /// </summary> /// <param name="valueWriter">值写入器</param> /// <param name="value">该类型的实例</param> public void WriteValue(IValueWriter valueWriter, T value) { if (value == null) { valueWriter.DirectWrite(null); return; } /* 父类引用,子类实例时使用 Type 获取写入器。 */ if (CheckChildrenInstance && Int64TypeHandle != (long)TypeHelper.GetTypeHandle(value)) { ValueInterface.GetInterface(value).Write(valueWriter, value); return; } var objectRW = XObjectRW.Create(typeof(T)); objectRW.Initialize(value); valueWriter.WriteObject(objectRW); }
public static object ReadScalar(DbDataReader dbDataReader, Type type) { return(ValueInterface.GetInterface(type).Read(new ReadScalarReader(dbDataReader))); }
public void OnReadValue(int key, IValueWriter valueWriter) { var value = dbDataReader[key]; ValueInterface.GetInterface(value).Write(valueWriter, value); }
public void OnWriteValue(object obj, IValueReader valueReader) { SetValue(obj, ValueInterface.GetInterface(AfterType).Read(valueReader)); }
public static object DeserializeObject(char *chars, int length, Type type) { return(ValueInterface.GetInterface(type).Read(new JsonDeserializer(chars, length))); }
static object DeserializeObject(char *chars, int length, Type type) { return(ValueInterface.GetInterface(type).Read(new JsonDeserializer <JsonDeserializeModes.Verified>(chars, length))); }
static object DeserializeObject(byte *bytes, int length, Type type) { return(ValueInterface.GetInterface(type).Read(new MessagePackDeserializer <MessagePackDeserializeModes.StandardMode>(bytes, length, DefaultMaxDepth))); }
private protected override void Initialize(FieldInfo fieldInfo, XBindingFlags flags) { @interface = ValueInterface.GetInterface(fieldInfo.FieldType); base.Initialize(fieldInfo, flags); }
private object InternalDeserialize <TMode>(char *chars, int length, Type type) where TMode : struct { return(ValueInterface.GetInterface(type).Read(new JsonDeserializer <TMode>(this, chars, length))); }