private void Creator(PacketFormat format, byte[] data) { // create format byte[] packetFormat = formatingPacket(format.getByteArrayFormat); // create data byte[] packetData = formatingPacket(data); // setting length of packet _data = new byte[packetFormat.Length + packetData.Length]; // copy format to packet Array.Copy(packetFormat, _data, packetFormat.Length); // copy data to packet Array.Copy(packetData, 0, _data, packetFormat.Length, packetData.Length); }
/// <summary> /// Create data formated with a format /// </summary> /// <param name="format">DarkKnight.Data.PacketFormat object</param> /// <param name="data">array of bytes data</param> public PacketCreator(PacketFormat format, byte[] data) { Creator(format, data); }