public void Deserialize(short msgType, string hex) { var writer = new NetworkWriter(); writer.StartMessage(msgType); writer.WriteBytesFull(Utils.ToByteArray(hex)); writer.FinishMessage(); Serializer.ProcessUNetMessages(UNetMessage.Serialize(writer.ToArray())); }
public ReplayPacketProvider(string path) : base(path) { Replay = ReplayFile.FromJson(File.ReadAllText(path)); for (uint pktId = 0; pktId < Replay.Messages.Length; pktId++) { var msg = Replay.Messages[pktId]; ProcessRawUnet(pktId, msg.Timestamp, PacketDirection.FromServer, UNetMessage.Serialize(msg.Data)); } }
public async Task SendWSMessage(byte[] bytes, int count) { var responseStream = new MemoryStream(); responseStream.Write(bytes, 0, count); using (var writer = Socket.CreateMessageWriter(WebSocketMessageType.Binary)) { await writer.WriteAsync(UNetMessage.Serialize(responseStream.ToArray())); await writer.FlushAsync(); } }
public async Task SendWSMessage(NetworkWriter msg) { var responseStream = new MemoryStream(); responseStream.Write(msg.AsArraySegment().Array, 0, msg.AsArraySegment().Count); using (var writer = Socket.CreateMessageWriter(WebSocketMessageType.Binary)) { await writer.WriteAsync(UNetMessage.Serialize(responseStream.ToArray())); await writer.FlushAsync(); } }