internal static Value Import(Coherent.UI.Binding.Importer importer) { var type = importer.Peek(); switch (type) { case ValueType.Null: { importer.SkipValue(); return(new Value()); } case ValueType.Boolean: return(new Value((bool)Coherent.UI.Binding.Importer.ReadBool(importer))); case ValueType.Integer: return(new Value((int)Coherent.UI.Binding.Importer.ReadInt(importer))); case ValueType.UInteger: return(new Value((uint)Coherent.UI.Binding.Importer.ReadUInt(importer))); case ValueType.SByte: return(new Value((sbyte)Coherent.UI.Binding.Importer.ReadSByte(importer))); case ValueType.Byte: return(new Value((byte)Coherent.UI.Binding.Importer.ReadByte(importer))); case ValueType.Number: return(new Value((double)Coherent.UI.Binding.Importer.ReadDouble(importer))); case ValueType.String: return(new Value((string)Coherent.UI.Binding.Importer.ReadString(importer))); case ValueType.Array: return(new Value(importer.Read <Value[]>())); case ValueType.Object: return(new Value(importer.Read <Dictionary <string, Value> >())); } return(null); }
public object Read(Importer importer) { if (!importer.IsNull()) { var result = System.Activator.CreateInstance(m_Type); var list = (System.Collections.IList)result; var size = importer.Reader.BeginSequence(ValueType.Array); for (var i = 0UL; i < size; ++i) { var item = importer.Read(m_Item); list.Add(item); } return result; } importer.SkipValue(); return null; }
public object Read(Importer importer) { if (!importer.IsNull()) { var result = System.Activator.CreateInstance(m_Type); var dict = (System.Collections.IDictionary)result; var size = importer.Reader.BeginSequence(ValueType.Object); for (var i = 0UL; i < size; ++i) { var key = importer.Read(m_Key); var value = importer.Read(m_Value); dict.Add(key, value); } return result; } importer.SkipValue(); return null; }
public object Read(Importer importer) { if (!importer.IsNull()) { var size = (int)importer.Reader.BeginSequence(ValueType.Array); var result = System.Activator.CreateInstance(m_Type, size); var array = (System.Array)result; for (var i = 0; i < size; ++i) { array.SetValue(importer.Read(m_Item), i); } return result; } importer.SkipValue(); return null; }
private void CheckType(Importer importer, object value) { var typename = (string)importer.Read(typeof(string)); if (RealTypeName != typename && !RealTypeName.StartsWith(typename)) { throw new BindingException(RealTypeName, typename); } }
internal object Read(Importer importer) { var result = Activator.CreateInstance(RealType); importer.ReadUserType(FieldSetters, result); return result; }
internal static object ReadFloat(Importer importer) { return(importer.Reader.ReadFloat()); }
internal static object ReadByte(Importer importer) { return(importer.Reader.ReadByte()); }
internal static object ReadValue(Importer importer) { return(Value.Import(importer)); }
public object Read(Importer importer) { return(importer.Read(m_Type)); }
internal static object ReadString(Importer importer) { return(importer.Reader.ReadString()); }
internal Importer GetImporter(IntPtr data) { Importer.SetData(data); return(Importer); }
internal static object ReadString(Importer importer) { return importer.Reader.ReadString(); }
internal static T Read <T>(this Importer importer) { return((T)importer.Read(typeof(T))); }
internal static object ReadFloat(Importer importer) { return importer.Reader.ReadFloat(); }
internal static object ReadByte(Importer importer) { return importer.Reader.ReadByte(); }
internal static object ReadValue(Importer importer) { return Value.Import(importer); }
public object Read(Importer importer) { return importer.Read(m_Type); }