Exemplo n.º 1
0
    public void deserializeFriendModuleOne(ByteBuffer data)
    {
        byte flag = data.ReadByte();

        if (flag == JustRun.ADD_FLAG)
        {
            FriendBody friend = new FriendBody();
            friend.deserialize(data);
            user.friends.Add(friend);
            friend.flag = flag;
        }
        else if (flag == JustRun.DEL_FLAG)
        {
            FriendBody friend = new FriendBody();
            friend.deserialize(data);
            for (int i = 0; i < user.friends.Count; i++)
            {
                FriendBody fb = user.friends[i];
                if (fb.fid == friend.fid && friend.uid == fb.uid)
                {
                    fb.flag = flag;
                    break;
                }
            }
        }
        else if (flag == JustRun.UPDATE_FLAG)
        {
            FriendBody friend = new FriendBody();
            friend.deserialize(data);
            for (int i = 0; i < user.friends.Count; i++)
            {
                FriendBody fb = user.friends[i];
                if (fb.fid == friend.fid && friend.uid == fb.uid)
                {
                    fb.copy(friend);
                    break;
                }
            }
        }
    }
Exemplo n.º 2
0
        public void deserialize(ByteBuffer buffer)
        {
            id         = buffer.ReadLong();
            account    = buffer.ReadString();
            face       = buffer.ReadString();
            nikeName   = buffer.ReadString();
            realyName  = buffer.ReadString();
            title      = buffer.ReadString();
            registTime = buffer.ReadString();
            indentity  = buffer.ReadString();
            signature  = buffer.ReadString();
            pushFlag   = buffer.ReadByte() == 1;
            int len = buffer.ReadInt();

            addresses.Clear();
            if (len > 0)
            {
                for (int i = 0; i < len; i++)
                {
                    addresses.Add(buffer.ReadString());
                }
            }
            recharge.deserialize(buffer);
            bacnkAccount.deserialize(buffer);
            seller.deserialize(buffer);
            len = buffer.ReadInt();
            emails.Clear();
            if (len > 0)
            {
                for (int i = 0; i < len; i++)
                {
                    EmailBody email = new EmailBody(this);
                    email.deserialize(buffer);
                    emails.Add(email);
                }
            }
            len = buffer.ReadInt();
            friends.Clear();
            if (len > 0)
            {
                for (int i = 0; i < len; i++)
                {
                    FriendBody friend = new FriendBody();
                    friend.deserialize(buffer);
                    friends.Add(friend);
                }
            }
            len = buffer.ReadInt();
            messages.Clear();
            if (len > 0)
            {
                for (int i = 0; i < len; i++)
                {
                    MessageBody message = new MessageBody();
                    message.deserialize(buffer);
                    messages.Add(message);
                }
            }
            len = buffer.ReadInt();
            favorites.Clear();
            if (len > 0)
            {
                for (int i = 0; i < len; i++)
                {
                    long value = buffer.ReadLong();
                    favorites.Add(value);
                }
            }
            endTime    = buffer.ReadString();
            permission = buffer.ReadInt();
            credit.deserialize(buffer);
            breach = buffer.ReadByte();
            forbid.deserialize(buffer);
            other   = buffer.ReadString();
            deposit = float.Parse(buffer.ReadString());
        }