コード例 #1
0
 public void Serialize(SerializeWriter writer)
 {
     writer.Write(Id);
     writer.WriteText(Name, false);
     writer.WriteText(Message, false);
     writer.Write(Image.Length);
     writer.Write(Image);
 }
コード例 #2
0
 public void Serialize(SerializeWriter writer)
 {
     // Determine how to serialize this object, so that it can be send via the Socket Stream
     writer.Write(x);
     writer.Write(y);
     writer.WriteText(z);
 }
コード例 #3
0
        public void Serialize(SerializeWriter writer)
        {
            writer.WriteText(QuestionStr, false);
            List <Answer> answers = new List <Answer>(Answers);

            answers.Shuffle();
            foreach (Answer answer in answers)
            {
                writer.Write(answer);
            }
        }
コード例 #4
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.WriteText(StudentName, false);
         }
         return(ms.ToArray());
     }
 }
コード例 #5
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.Write((byte)Message.Type);
             sw.WriteText(Message.ToString());
         }
         return(ms.ToArray());
     }
 }
コード例 #6
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             // Write the data you want to the underlying buffer
             sw.Write(StatusCode);
             sw.WriteText(Message);
             // with a serializable object, you write it like this instead
             Object.Serialize(sw);
             // Client that receive this should read the Status Code first then the Message and then Object.
         }
         return(ms.ToArray());
     }
 }
コード例 #7
0
 public override byte[] GetBytes()
 {
     using (var ms = new MemoryStream())
     {
         using (var sw = new SerializeWriter(ms))
         {
             sw.WriteText(QuizName, false);
             sw.Write(WaitingRoom.Clients.Count);
             foreach (var client in WaitingRoom.Clients)
             {
                 sw.WriteTextStatic(client.Character.Token, 44);
                 sw.WriteTextStatic(client.Character.Name, 13);
                 sw.Write(client.Character.CharacterDb.HeadEqp);
             }
         }
         return(ms.ToArray());
     }
 }
コード例 #8
0
ファイル: Answer.cs プロジェクト: tim-low/SSAD-game-server
 public void Serialize(SerializeWriter writer)
 {
     writer.Write(Id);
     writer.WriteText(Text, false);
 }
コード例 #9
0
ファイル: Message.cs プロジェクト: tim-low/SSAD-game-server
 /// <summary>
 /// Serialize the content, so we can send this object through the network stream
 /// </summary>
 /// <param name="writer"></param>
 public void Serialize(SerializeWriter writer)
 {
     writer.Write((byte)Type);
     writer.WriteText(Text);
     writer.Write(Tick.Ticks);
 }