Exemplo n.º 1
0
 public IByteBuffer Encode(IByteBuffer byteBuf)
 {
     ByteBufUtils.WriteUTF8(byteBuf, FirstName);
     ByteBufUtils.WriteUTF8(byteBuf, LastName);
     ByteBufUtils.WriteUTF8(byteBuf, Town);
     ByteBufUtils.WriteUTF8(byteBuf, DateOfBirth.ToString());
     byteBuf.WriteInt((int)Gender);
     return(byteBuf);
 }
Exemplo n.º 2
0
 public IByteBuffer Encode(IByteBuffer byteBuf)
 {
     foreach (var noti in Notifications)
     {
         ByteBufUtils.WriteUTF8(byteBuf, noti);
     }
     ByteBufUtils.WriteUTF8(byteBuf, "~");
     return(byteBuf);
 }
Exemplo n.º 3
0
        public override IByteBuffer EncodeToBuffer(IByteBuffer buffer)
        {
            string notification = new ChatUserStore().Load(AdderID).FirstName +
                                  " invited " + new ChatUserStore().Load(AddedID).FirstName +
                                  " to group";

            ByteBufUtils.WriteUTF8(buffer, notification);
            return(buffer);
        }
Exemplo n.º 4
0
        public void Decode(IByteBuffer buffer)
        {
            BackgroundId   = ByteBufUtils.ReadUTF8(buffer);
            BackgroundBlur = buffer.ReadInt();

            BackgroundColor = buffer.ReadInt();
            UseType         = (ChatBackgroundType)buffer.ReadInt();

            IconColor = buffer.ReadInt();
        }
Exemplo n.º 5
0
        public void Decode(IByteBuffer buffer)
        {
            string noti = ByteBufUtils.ReadUTF8(buffer);

            while (!noti.Equals("~"))
            {
                Notifications.Add(noti);
                noti = ByteBufUtils.ReadUTF8(buffer);
            }
        }
 public void Decode(IByteBuffer buffer)
 {
     try
     {
         TargetID = Guid.Parse(ByteBufUtils.ReadUTF8(buffer));
     }
     catch
     {
     }
 }
Exemplo n.º 7
0
        public override IByteBuffer WriteHeader(IByteBuffer header, PacketRegistration packet, IByteBuffer data)
        {
            IByteBuffer opcodeBuffer = Unpooled.Buffer(5);

            ByteBufUtils.WriteVarInt(opcodeBuffer, packet.Opcode);
            ByteBufUtils.WriteVarInt(header, opcodeBuffer.ReadableBytes + data.ReadableBytes);
            opcodeBuffer.Release();
            ByteBufUtils.WriteVarInt(header, packet.Opcode);
            return(header);
        }
Exemplo n.º 8
0
 public IByteBuffer Encode(IByteBuffer byteBuf)
 {
     ByteBufUtils.WriteUTF8(byteBuf, Email);
     ByteBufUtils.WriteUTF8(byteBuf, PassHashed);
     ByteBufUtils.WriteUTF8(byteBuf, FirstName);
     ByteBufUtils.WriteUTF8(byteBuf, LastName);
     byteBuf.WriteLong(DoB.Ticks);
     byteBuf.WriteInt((int)Gender);
     return(byteBuf);
 }
Exemplo n.º 9
0
 public IByteBuffer Encode(IByteBuffer byteBuf)
 {
     ByteBufUtils.WriteUTF8(byteBuf, FirstName);
     ByteBufUtils.WriteUTF8(byteBuf, LastName);
     ByteBufUtils.WriteUTF8(byteBuf, Town);
     ByteBufUtils.WriteUTF8(byteBuf, Email);
     byteBuf.WriteLong(DateOfBirth.Ticks);
     byteBuf.WriteInt((int)Gender);
     return(byteBuf);
 }
Exemplo n.º 10
0
        public void Decode(IByteBuffer buffer)
        {
            Theme = new ChatTheme();
            Theme.BackgroundId   = ByteBufUtils.ReadUTF8(buffer);
            Theme.BackgroundBlur = buffer.ReadInt();

            Theme.BackgroundColor = buffer.ReadInt();
            Theme.Use             = (BackgroundType)buffer.ReadInt();

            Theme.IconColor = buffer.ReadInt();
        }
Exemplo n.º 11
0
        public IByteBuffer Encode(IByteBuffer byteBuf)
        {
            foreach (var conversation in Conversations)
            {
                ByteBufUtils.WriteUTF8(byteBuf, conversation.Key.ToString());
                byteBuf.WriteLong(conversation.Value);
            }

            ByteBufUtils.WriteUTF8(byteBuf, "~");
            return(byteBuf);
        }
Exemplo n.º 12
0
 public IByteBuffer Encode(IByteBuffer byteBuf)
 {
     for (int i = 0; i < SenderID.Count; ++i)
     {
         ByteBufUtils.WriteUTF8(byteBuf, SenderID[i]);
         byteBuf = Content[i].EncodeToBuffer(byteBuf);
     }
     ByteBufUtils.WriteUTF8(byteBuf, "~");
     byteBuf.WriteBoolean(LoadConversation);
     return(byteBuf);
 }
Exemplo n.º 13
0
        public void Decode(IByteBuffer buffer)
        {
            FirstName   = ByteBufUtils.ReadUTF8(buffer);
            LastName    = ByteBufUtils.ReadUTF8(buffer);
            Town        = ByteBufUtils.ReadUTF8(buffer);
            Email       = ByteBufUtils.ReadUTF8(buffer);
            DateOfBirth = new DateTime(buffer.ReadLong());
            Gender      = (Gender)buffer.ReadInt();

            // Avatar ID
        }
Exemplo n.º 14
0
        public void Decode(IByteBuffer buffer)
        {
            string id = ByteBufUtils.ReadUTF8(buffer);
            long   lastActive;

            while (id != "~")
            {
                lastActive = buffer.ReadLong();
                Conversations.Add(id, lastActive);
                id = ByteBufUtils.ReadUTF8(buffer);
            }
        }
        public void Decode(IByteBuffer buffer)
        {
            string id = ByteBufUtils.ReadUTF8(buffer);

            while (!id.Equals("~"))
            {
                FileIDs.Add(id);
                FileNames.Add(ByteBufUtils.ReadUTF8(buffer));
                Positions.Add(buffer.ReadInt());
                id = ByteBufUtils.ReadUTF8(buffer);
            }
        }
Exemplo n.º 16
0
        public void Decode(IByteBuffer buffer)
        {
            string id;

            id = ByteBufUtils.ReadUTF8(buffer);

            while (id != "~")
            {
                ids.Add(id);
                id = ByteBufUtils.ReadUTF8(buffer);
            }
        }
Exemplo n.º 17
0
        public IByteBuffer Encode(IByteBuffer byteBuf)
        {
            ByteBufUtils.WriteUTF8(byteBuf, BackgroundId);
            byteBuf.WriteInt(BackgroundBlur);

            byteBuf.WriteInt(BackgroundColor);

            byteBuf.WriteInt((int)UseType);

            byteBuf.WriteInt(IconColor);

            return(byteBuf);
        }
        public IByteBuffer Encode(IByteBuffer byteBuf)
        {
            for (int i = 0; i < FileIDs.Count; ++i)
            {
                ByteBufUtils.WriteUTF8(byteBuf, FileIDs[i]);
                ByteBufUtils.WriteUTF8(byteBuf, FileNames[i]);
                byteBuf.WriteInt(Positions[i]);
            }

            ByteBufUtils.WriteUTF8(byteBuf, "~");

            return(byteBuf);
        }
Exemplo n.º 19
0
        public IByteBuffer Encode(IByteBuffer byteBuf)
        {
            ByteBufUtils.WriteUTF8(byteBuf, Theme.BackgroundId);
            byteBuf.WriteInt(Theme.BackgroundBlur);

            byteBuf.WriteInt(Theme.BackgroundColor);

            byteBuf.WriteInt((int)Theme.Use);

            byteBuf.WriteInt(Theme.IconColor);

            return(byteBuf);
        }
Exemplo n.º 20
0
        public IByteBuffer Encode(IByteBuffer byteBuf)
        {
            ByteBufUtils.WriteUTF8(byteBuf, ID);
            ByteBufUtils.WriteUTF8(byteBuf, FirstName);
            ByteBufUtils.WriteUTF8(byteBuf, LastName);
            ByteBufUtils.WriteUTF8(byteBuf, LastMess);
            ByteBufUtils.WriteUTF8(byteBuf, ConversationID);
            byteBuf.WriteInt(PreviewCode);
            byteBuf.WriteBoolean(IsOnline);
            byteBuf.WriteLong(LastLogout.Ticks);
            byteBuf.WriteInt(RelationshipType);

            return(byteBuf);
        }
Exemplo n.º 21
0
        public void Decode(IByteBuffer buffer)
        {
            ID             = ByteBufUtils.ReadUTF8(buffer);
            FirstName      = ByteBufUtils.ReadUTF8(buffer);
            LastName       = ByteBufUtils.ReadUTF8(buffer);
            LastMessage    = ByteBufUtils.ReadUTF8(buffer);
            ConversationID = ByteBufUtils.ReadUTF8(buffer);
            PreviewCode    = buffer.ReadInt();
            IsOnline       = buffer.ReadBoolean();
            LastLogout     = new DateTime(buffer.ReadLong());
            Relationship   = buffer.ReadInt();

            Console.WriteLine(FirstName + " " + LastName);
        }
Exemplo n.º 22
0
        public IByteBuffer Encode(IByteBuffer byteBuf)
        {
            foreach (var item in Results)
            {
                ByteBufUtils.WriteUTF8(byteBuf, item.ID);
                ByteBufUtils.WriteUTF8(byteBuf, item.FirstName);
                ByteBufUtils.WriteUTF8(byteBuf, item.LastName);
                ByteBufUtils.WriteUTF8(byteBuf, item.LastMessage);
                ByteBufUtils.WriteUTF8(byteBuf, item.ConversationID);
                byteBuf.WriteInt(item.PreviewCode);
                byteBuf.WriteBoolean(item.IsOnline);
                byteBuf.WriteLong(item.LastLogout.Ticks);
                byteBuf.WriteInt(item.Relationship);
            }

            ByteBufUtils.WriteUTF8(byteBuf, "~");

            return(byteBuf);
        }
Exemplo n.º 23
0
        public void Decode(IByteBuffer buffer)
        {
            string id = ByteBufUtils.ReadUTF8(buffer);

            while (id != "~")
            {
                SearchResult result = new SearchResult();

                result.ID             = id;
                result.FirstName      = ByteBufUtils.ReadUTF8(buffer);
                result.LastName       = ByteBufUtils.ReadUTF8(buffer);
                result.LastMessage    = ByteBufUtils.ReadUTF8(buffer);
                result.ConversationID = ByteBufUtils.ReadUTF8(buffer);
                result.PreviewCode    = buffer.ReadInt();
                result.IsOnline       = buffer.ReadBoolean();
                result.LastLogout     = new DateTime(buffer.ReadLong());
                result.Relationship   = buffer.ReadInt();

                Results.Add(result);
                id = ByteBufUtils.ReadUTF8(buffer);
            }
        }
Exemplo n.º 24
0
        public IByteBuffer Encode(IByteBuffer byteBuf)
        {
            ByteBufUtils.WriteUTF8(byteBuf, ConversationID);
            ByteBufUtils.WriteUTF8(byteBuf, ConversationName);
            byteBuf.WriteInt(StatusCode);
            byteBuf.WriteLong(LastActive);

            foreach (var member in Members)
            {
                ByteBufUtils.WriteUTF8(byteBuf, member);
            }
            ByteBufUtils.WriteUTF8(byteBuf, "~");

            byteBuf.WriteInt(LastMessID);
            byteBuf.WriteInt(LastMediaID);
            byteBuf.WriteInt(LastAttachmentID);
            byteBuf.WriteInt(PreviewCode);
            byteBuf.WriteInt(BubbleColor);
            ByteBufUtils.WriteUTF8(byteBuf, PreviewContent);

            return(byteBuf);
        }
Exemplo n.º 25
0
        public void Decode(IByteBuffer buffer)
        {
            ConversationID   = ByteBufUtils.ReadUTF8(buffer);
            ConversationName = ByteBufUtils.ReadUTF8(buffer);
            StatusCode       = buffer.ReadInt();
            LastActive       = buffer.ReadLong();

            // Get the number of members in this conversation
            string temp = ByteBufUtils.ReadUTF8(buffer);

            while (temp != "~")
            {
                Members.Add(temp);
                temp = ByteBufUtils.ReadUTF8(buffer);
            }

            LastMessID       = buffer.ReadInt();
            LastMediaID      = buffer.ReadInt();
            LastAttachmentID = buffer.ReadInt();
            PreviewCode      = buffer.ReadInt();
            BubbleColor      = buffer.ReadInt();
            PreviewContent   = ByteBufUtils.ReadUTF8(buffer);
        }
Exemplo n.º 26
0
 public override void DecodeFromBuffer(IByteBuffer buffer)
 {
     FileID   = ByteBufUtils.ReadUTF8(buffer);
     FileName = ByteBufUtils.ReadUTF8(buffer);
 }
Exemplo n.º 27
0
 public IByteBuffer Encode(IByteBuffer byteBuf)
 {
     ByteBufUtils.WriteUTF8(byteBuf, mess);
     return(byteBuf);
 }
Exemplo n.º 28
0
 public void Decode(IByteBuffer buffer)
 {
     mess = ByteBufUtils.ReadUTF8(buffer);
 }
Exemplo n.º 29
0
        public IByteBuffer Encode(IByteBuffer byteBuf)
        {
            ByteBufUtils.WriteUTF8(byteBuf, TargetUserID);

            return(byteBuf);
        }
Exemplo n.º 30
0
 public void Decode(IByteBuffer buffer)
 {
     ConversationID = Guid.Parse(ByteBufUtils.ReadUTF8(buffer));
 }