public PBEBattleStatusPacket(byte[] buffer, PBEBattle battle)
 {
     using (var r = new BinaryReader(new MemoryStream(buffer)))
     {
         r.ReadInt16(); // Skip Code
         BattleStatus       = (PBEBattleStatus)r.ReadByte();
         BattleStatusAction = (PBEBattleStatusAction)r.ReadByte();
     }
 }
        public PBEBattleStatusPacket(PBEBattleStatus battleStatus, PBEBattleStatusAction battleStatusAction)
        {
            var bytes = new List <byte>();

            bytes.AddRange(BitConverter.GetBytes(Code));
            bytes.Add((byte)(BattleStatus = battleStatus));
            bytes.Add((byte)(BattleStatusAction = battleStatusAction));
            Buffer = BitConverter.GetBytes((short)bytes.Count).Concat(bytes);
        }
        internal PBEBattleStatusPacket(PBEBattleStatus battleStatus, PBEBattleStatusAction battleStatusAction)
        {
            var bytes = new List <byte>();

            bytes.AddRange(BitConverter.GetBytes(Code));
            bytes.Add((byte)(BattleStatus = battleStatus));
            bytes.Add((byte)(BattleStatusAction = battleStatusAction));
            bytes.InsertRange(0, BitConverter.GetBytes((short)bytes.Count));
            Buffer = new ReadOnlyCollection <byte>(bytes);
        }
示例#4
0
 internal PBEBattleStatusPacket(PBEBattleStatus battleStatus, PBEBattleStatusAction battleStatusAction)
 {
     using (var ms = new MemoryStream())
         using (var w = new EndianBinaryWriter(ms, encoding: EncodingType.UTF16))
         {
             w.Write(Code);
             w.Write(BattleStatus       = battleStatus);
             w.Write(BattleStatusAction = battleStatusAction);
             Data = new ReadOnlyCollection <byte>(ms.ToArray());
         }
 }
 internal PBEBattleStatusPacket(ReadOnlyCollection <byte> buffer, BinaryReader r, PBEBattle battle)
 {
     Buffer             = buffer;
     BattleStatus       = (PBEBattleStatus)r.ReadByte();
     BattleStatusAction = (PBEBattleStatusAction)r.ReadByte();
 }
示例#6
0
 internal PBEBattleStatusPacket(byte[] data, EndianBinaryReader r)
 {
     Data               = new ReadOnlyCollection <byte>(data);
     BattleStatus       = r.ReadEnum <PBEBattleStatus>();
     BattleStatusAction = r.ReadEnum <PBEBattleStatusAction>();
 }