예제 #1
0
        public static void Write <T>(TLBinaryWriter to, object value)
        {
            if (value == null)
            {
                to.WriteUInt32(0x56730BCC);
                return;
            }

            var type = typeof(T);

            if (type == typeof(UInt32))
            {
                to.WriteUInt32((uint)value);
            }
            else if (type == typeof(Int32))
            {
                to.WriteInt32((int)value);
            }
            else if (type == typeof(UInt64))
            {
                to.WriteUInt64((ulong)value);
            }
            else if (type == typeof(Int64))
            {
                to.WriteInt64((long)value);
            }
            else if (type == typeof(Double))
            {
                to.WriteDouble((double)value);
            }
            else if (type == typeof(Boolean))
            {
                to.WriteBoolean((bool)value);
            }
            else if (type == typeof(String))
            {
                to.WriteString((string)value);
            }
            else if (type == typeof(Byte[]))
            {
                to.WriteByteArray((byte[])value);
            }
            else
            {
                to.WriteObject((TLObject)value);
            }
        }
예제 #2
0
 public override void Write(TLBinaryWriter to)
 {
     to.WriteUInt32(0xFFFFFF0D);
     to.WriteInt32(SendBefore);
     Action.Write(to);
 }
예제 #3
0
 public override void Write(TLBinaryWriter to)
 {
     to.WriteUInt32(0xFFFFFF10);
     to.WriteInt32(Date);
 }