public static Byte[] QuickMessage(UInt64 TransactionID, UInt32 Type, String Data, SteamClient Client) { NetworkPacket NewPacket = new NetworkPacket(); redBuffer NewBuffer = new redBuffer(); NewBuffer.WriteBlob(Encoding.ASCII.GetBytes(Data)); NewPacket.CreatePacket(TransactionID, Type, NewBuffer, Client); NewBuffer = new redBuffer(); NewPacket.Serialize(ref NewBuffer, Client); return NewBuffer.GetBuffer(); }
// Handles all packets and calls the service designated to the packet type. public void HandlePacket(SteamClient Client) { redBuffer InternalBuffer; Byte[] ServiceData = new Byte[1]; NetworkPacket ServicePacket = new NetworkPacket(); // Serialize and create the packet. InternalBuffer = new redBuffer(Client.Buffer); InternalBuffer.ReadBlob(ref ServiceData); ServicePacket.Deserialize(new redBuffer(ServiceData), Client); // Log that we got a packet for debug. Log.Debug(String.Format("PacketType: {0}", ServicePacket._Type)); // If it's a heartbeat packet, drop it. if(ServicePacket._Type == 64) return; // Send the packet to the right service. if(ServiceMap.ContainsKey(ServicePacket._Type)) ServiceMap[ServicePacket._Type].HandlePacket(ref ServicePacket, ref Client); else Log.Debug(String.Format("Couldn't find a service for {0}", ServicePacket._Type)); }