hds.RPCPacket.getBytesWithHeader C# (CSharp) Method

getBytesWithHeader() public method

public getBytesWithHeader ( bool timedRPC ) : byte[]
timedRPC bool
return byte[]
        public byte[] getBytesWithHeader(bool timedRPC)
        {
            DynamicArray rpcStructure = new DynamicArray();
            byte[] noTimedHeader = {0x04};
            byte[] timedHeader = new byte[6];
            byte[] time = TimeUtils.getUnixTime();

            timedHeader[0] = 0x82;

            ArrayUtils.copy(time,0,timedHeader,1,4);
            timedHeader[5] = 0x04; // This makes it "82aabbccdd04"

            if(timedRPC)
                rpcStructure.append(timedHeader);
            else
                rpcStructure.append(noTimedHeader);

            // Calculate blocks number

            if (rpcInside==0){ // Is just 1 group of msgblocks
                rpcInside=1;
                rpcStructure.append(NumericalUtils.uint16ToByteArrayShort((UInt16)rpcInside));
                rpcStructure.append(getBytes()); //Append our own content
            }
            else{
                rpcStructure.append(NumericalUtils.uint16ToByteArrayShort((UInt16)rpcInside));
                rpcStructure.append(din.getBytes()); //Append our own content
            }

            return rpcStructure.getBytes();
        }

Usage Example

コード例 #1
0
ファイル: PacketsUtils.cs プロジェクト: neowhoru/mxo-hd
        public static byte[] createRpcPacket(ArrayList contents, bool timedRPC, WorldClient client)
        {
            RPCPacket rpcp = new RPCPacket(client);

            for (int i = 0; i < contents.Count; i++)
            {
                rpcp.appendMsgBlock((byte[])contents[i]);
            }

            return(rpcp.getBytesWithHeader(timedRPC));
        }
All Usage Examples Of hds.RPCPacket::getBytesWithHeader