예제 #1
0
        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()));
        }
예제 #2
0
        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));
            }
        }
예제 #3
0
        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();
            }
        }
예제 #4
0
        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();
            }
        }