Esempio n. 1
0
        private bool ProcessControlMessage(ENetCommand cmd, BufferRead buf)
        {
            if (cmd == ENetCommand.NetNop)
            {
                return(true);
            }

            if (cmd == ENetCommand.NetDisconnect)
            {
                var reason = buf.ReadString();
                _messageHandler.ConnectionClosing(reason);
                return(false);
            }

            if (cmd == ENetCommand.NetFile)
            {
                var transferId = buf.ReadUInt();
                var fileName   = buf.ReadString();

                if (buf.ReadByte() != 0 && IsSafeFileToDownload(fileName))
                {
                    _messageHandler.FileRequested(fileName, transferId);
                }
                else
                {
                    _messageHandler.FileDenied(fileName, transferId);
                }

                return(true);
            }

            Console.WriteLine("NetChannel: Received bad control command type {0} from {1}.", (ushort)cmd, _remoteAddress);
            return(false);
        }
Esempio n. 2
0
        public override bool ReadFromBuffer(BufferRead buffer)
        {
            _state = (ESignonState)buffer.ReadByte();

            return(true);
        }