コード例 #1
0
        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);
        }
コード例 #2
0
		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;
		}
コード例 #3
0
		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;
		}
コード例 #4
0
		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;
		}
コード例 #5
0
		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);
			}
		}
コード例 #6
0
		internal object Read(Importer importer)
		{
			var result = Activator.CreateInstance(RealType);
			importer.ReadUserType(FieldSetters, result);
			return result;
		}
コード例 #7
0
 internal static object ReadFloat(Importer importer)
 {
     return(importer.Reader.ReadFloat());
 }
コード例 #8
0
 internal static object ReadByte(Importer importer)
 {
     return(importer.Reader.ReadByte());
 }
コード例 #9
0
 internal static object ReadValue(Importer importer)
 {
     return(Value.Import(importer));
 }
コード例 #10
0
 public object Read(Importer importer)
 {
     return(importer.Read(m_Type));
 }
コード例 #11
0
 internal static object ReadString(Importer importer)
 {
     return(importer.Reader.ReadString());
 }
コード例 #12
0
 internal Importer GetImporter(IntPtr data)
 {
     Importer.SetData(data);
     return(Importer);
 }
コード例 #13
0
		internal static object ReadString(Importer importer)
		{
			return importer.Reader.ReadString();
		}
コード例 #14
0
 internal static T Read <T>(this Importer importer)
 {
     return((T)importer.Read(typeof(T)));
 }
コード例 #15
0
		internal static object ReadFloat(Importer importer)
		{
			return importer.Reader.ReadFloat();
		}
コード例 #16
0
		internal static object ReadByte(Importer importer)
		{
			return importer.Reader.ReadByte();
		}
コード例 #17
0
		internal static object ReadValue(Importer importer)
		{
			return Value.Import(importer);
		}
コード例 #18
0
			public object Read(Importer importer)
			{
				return importer.Read(m_Type);
			}