public ObjectStatusUpdatePacket(byte[] byteArray) { if (byteArray != null) { if (_log.IsInfoEnabled) { _log.InfoFormat("{0}--bytes in: {1}", MethodBase.GetCurrentMethod().ToString(), Utility.BytesToDebugString(byteArray)); } if (byteArray.Length > 1) { SubPacketType = (ObjectStatusUpdateSubPacketTypes)byteArray[0]; //BitConverter.ToInt32(byteArray, 0); if (_log.IsInfoEnabled) { _log.InfoFormat("SubPacketType={0}", SubPacketType.ToString()); } } List <byte> bytes = new List <byte>(); for (int i = 1; i < byteArray.Length; i++) { bytes.Add(byteArray[i]); } SubPacketData = bytes.ToArray(); _subPacket = GetSubPacket(SubPacketData); //if (byteArray.Length > 4) //{ // List<byte> bytes = new List<byte>(); // for (int i = 4; i < byteArray.Length; i++) // { // bytes.Add(byteArray[i]); // } // SubPacketData = bytes.ToArray(); // _subPacket = GetSubPacket(SubPacketData); //} //else //{ // _subPacket = null; // SubPacketData = null; //} if (_log.IsInfoEnabled) { _log.InfoFormat("{0}--Result bytes: {1}", MethodBase.GetCurrentMethod().ToString(), Utility.BytesToDebugString(this.GetBytes())); } } }
public SubPacketAttribute(SubPacketType type, bool log = true) { Type = type; Log = log; }
public static NetPacket SerializePylonWasAddedOrRemoved(TeleportPylonInfo info, SubPacketType packetType) { NetPacket result = NetModule.CreatePacket <NetTeleportPylonModule>(6); result.Writer.Write((byte)packetType); result.Writer.Write(info.PositionInTiles.X); result.Writer.Write(info.PositionInTiles.Y); result.Writer.Write((byte)info.TypeOfPylon); return(result); }
public SubPacketHandlerAttribute(SubPacketType type, SubPacketHandlerFlags flags = SubPacketHandlerFlags.None) { Type = type; Flags = flags; }