Ejemplo n.º 1
0
        public void WriteCommandPacket(CargoCommand packetHeader, byte[] argBuf, bool flush)
        {
            // Note: turns out argBuf can be null
            var bufLength = (argBuf == null ? 0 : argBuf.Length);

            this.CargoWriter.WriteByte((byte)((System.Runtime.InteropServices.Marshal.SizeOf(packetHeader)) + bufLength));

            this.CargoWriter.WriteStruct <CargoCommand>(ref packetHeader);

            if (bufLength > 0)
            {
                this.CargoWriter.Write(argBuf);
            }

            if (flush)
            {
                this.CargoWriter.Flush();
            }
        }
Ejemplo n.º 2
0
        public void WriteCommandPacket(CargoCommand packetHeader, byte[] argBuf, bool flush)
        {
            // Note: turns out argBuf can be null
            var bufLength = (argBuf == null ? 0 : argBuf.Length);

            this.CargoWriter.WriteByte((byte)((System.Runtime.InteropServices.Marshal.SizeOf(packetHeader)) + bufLength));

            this.CargoWriter.WriteStruct<CargoCommand>(ref packetHeader);

            if (bufLength > 0)
            {
                this.CargoWriter.Write(argBuf);
            }

            if (flush)
            {
                this.CargoWriter.Flush();
            }
        }