示例#1
0
        public override void SerializeBody(BinaryWriter bw)
        {
            bw.Write(this.Constructor);
            bw.Write(this.lists.Count());

            foreach (T item in this.lists)
            {
                if (typeof(T) == typeof(int))
                {
                    int res = (int)Convert.ChangeType(item, typeof(int));

                    bw.Write(res);
                }
                else if (typeof(T) == typeof(long))
                {
                    long res = (long)Convert.ChangeType(item, typeof(long));
                    bw.Write(res);
                }
                else if (typeof(T) == typeof(string))
                {
                    string res = (string)(Convert.ChangeType(item, typeof(string)));
                    StringUtil.Serialize(res, bw);
                }
                else if (typeof(T) == typeof(double))
                {
                    double res = (double)Convert.ChangeType(item, typeof(double));
                    bw.Write(res);
                }
                else if (typeof(T).BaseType == typeof(TLObject))
                {
                    TLObject res = (TLObject)(object)item;
                    res.SerializeBody(bw);
                }
            }
        }
示例#2
0
 public override void DeserializeResponse(BinaryReader br)
 {
     Response = (TLObject)ObjectUtils.DeserializeObject(br);
 }
 public override void deserializeResponse(BinaryReader br)
 {
     Response = (TLObject)ObjectUtils.DeserializeObject(br);
 }