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

        if (flag == JustRun.ADD_FLAG)
        {
            MessageBody message = new MessageBody();
            message.deserialize(data);
            user.messages.Add(message);
        }
        else if (flag == JustRun.DEL_FLAG)
        {
            MessageBody message = new MessageBody();
            message.deserialize(data);
            for (int i = 0; i < user.messages.Count; i++)
            {
                MessageBody mb = user.messages[i];
                if (mb.id == message.id)
                {
                    user.messages.RemoveAt(i);
                    break;
                }
            }
        }
        else if (flag == JustRun.UPDATE_FLAG)
        {
            MessageBody message = new MessageBody();
            message.deserialize(data);
            for (int i = 0; i < user.messages.Count; i++)
            {
                MessageBody mb = user.messages[i];
                if (mb.id == message.id)
                {
                    mb.copy(message);
                    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());
        }