Advertisement
Guest User

DebugHighlightCellsMessage.cs

a guest
Jun 29th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Past.Protocol;
  5. using Past.IO;
  6.  
  7. namespace Past.Protocol.Messages.debug
  8. {
  9.     public class DebugHighlightCellsMessage
  10.     {
  11.         public new const uint ID = 2001;
  12.         public override uint ProtocolID
  13.         {
  14.             get { return ID; }
  15.         }
  16.  
  17.         public int color;
  18.         public short[] cells;
  19.  
  20.         public DebugHighlightCellsMessage()
  21.         {
  22.         }
  23.  
  24.         public DebugHighlightCellsMessage(int color, short[] cells)
  25.         {
  26.             this.color = color;
  27.             this.cells = cells;
  28.         }
  29.  
  30.         public override void Serialize(BigEndianWriter writer)
  31.         {
  32.             writer.WriteInt(color);
  33.             writer.WriteUShort((ushort)cells.Length);
  34.             foreach (var entry in cells)
  35.             {
  36.                 writer.WriteShort(entry);
  37.             }
  38.         }
  39.  
  40.         public override void Deserialize(BigEndianReader reader)
  41.         {
  42.             color = reader.ReadInt();
  43.             var limit = reader.ReadUShort();
  44.             cells = new short[limit];
  45.             for (int i = 0; i < limit; i++)
  46.             {
  47.                 cells[i] = reader.ReadShort();
  48.             }
  49.         }
  50.  
  51.     }
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement