Пример #1
0
        public static void Init()
        {
            collectThread = new Thread(PacketCollectionThread);
            collectThread.Start();

            RPCSerializer.Init();

            CustomRPC.DocAllRPCAttributes();
        }
Пример #2
0
        public static CustomPacket ParseCustomPacket(byte[] data)
        {
            ulong packetID = BitConverter.ToUInt64(data, 0);
            bool  ignoreID = BitConverter.ToUInt16(data, 8) == 0 ? false : true;

            int stringSize = 0;

            for (; stringSize + 8 < data.Length && data[stringSize + 10] != 0; stringSize++)
            {
            }

            string RPCName = Encoding.ASCII.GetString(data, 10, stringSize);

            byte[] clippedData = new byte[data.Length - 11 - stringSize];

            for (int i = 0; i < clippedData.Length; i++)
            {
                clippedData[i] = data[i + 9 + stringSize];
            }

            return(new CustomPacket(packetID, RPCName, ignoreID, RPCSerializer.GetCompleteDeserializedData(clippedData)));
        }
Пример #3
0
 /// <summary>
 /// ONLY FOR DEBUG USE, DO NOT, I REPEAT, DO NOT USE THIS FOR ANYTHING OTHER THAN TESTING PACKET SENDING LOCALLY!!!!!
 /// </summary>
 /// <param name="rpcName"></param>
 /// <param name="args"></param>
 public static void SendRPCToSelf(string rpcName, params object[] args)
 {
     SendPacketToPlayer(SteamUser.GetSteamID(), rpcName, RPCSerializer.GetCompleteSerializedData(args));
 }
Пример #4
0
 public static void SendRPCToPlayersInGame(string rpcName, params object[] args)
 {
     SendPacketToPlayersInGame(rpcName, RPCSerializer.GetCompleteSerializedData(args));
 }
Пример #5
0
 public static void SendRPCToPlayersInGame(string rpcName, bool isTCP = false, bool ignoreID = false, params object[] args)
 {
     SendPacketToPlayersInGame(rpcName, RPCSerializer.GetCompleteSerializedData(args), isTCP, ignoreID);
 }