Пример #1
0
        private void OnCS_IMC_Enter_Req(SecurePacketRequest reqPacket)
        {
            SecurePacketResponse resPacket = new SecurePacketResponse(reqPacket);

            try
            {
                if (_user.CastChannel != null)
                    throw new AegisException(ResultCode.IMC_InChannel);

                Int32 channelNo = reqPacket.GetInt32();
                _user.CastChannel = CastChannel.GetChannel(channelNo);

                _user.CastChannel.Enter(_user);
                {
                    SecurePacket ntfPacket = new SecurePacket(Protocol.GetID("CS_IMC_EnteredUser_Ntf"));
                    ntfPacket.PutInt32(ResultCode.Ok);
                    ntfPacket.PutInt32(_user.UserNo);
                    ntfPacket.PutStringAsUtf16(_user.Profile.Nickname);

                    _user.CastChannel.Broadcast(ntfPacket, _user);
                }

                resPacket.ResultCodeNo = ResultCode.Ok;
                resPacket.PutInt32(_user.CastChannel.ChannelNo);
                resPacket.PutStringAsUtf16(_user.CastChannel.Name);
            }
            catch (AegisException e)
            {
                resPacket.ResultCodeNo = e.ResultCodeNo;
            }

            SendPacket(resPacket);
        }
Пример #2
0
        public void ForceClose(String message)
        {
            SecurePacket ntfPacket = new SecurePacket(Protocol.GetID("CS_Auth_ForceClosing_Ntf"));
            ntfPacket.PutStringAsUtf16(message);

            SendPacket(ntfPacket, (sentPacket) =>
            {
                Close();
            });
        }