Exemplo n.º 1
0
        /// <summary>
        /// Takes a string and sends it to the server using the TCP connection.
        /// </summary>
        /// <param name="targetGroup"></param>
        /// <param name="bodyMessage"></param>
        public void SendChatMessage(ChatGroup targetGroup, string bodyMessage)
        {
            Message        chatMessage = null;
            ManagedMessage managedReference;

            if (ChatMessage.CreateChatMessage(this.owner, targetGroup, bodyMessage, out chatMessage) == Error.ErrorType.Ok)
            {
                managedReference = (ManagedMessage)chatMessage;
                PacketHandler.EncodeRawPacket(ref managedReference.OwnerNetworkEntity.ownerNetworkCollection.rawBuffer);
                if (!((GameClient)this.owner).OutgoingTCPQueue.EnqueueCommandMessage(ref chatMessage))
                {
                    chatMessage.Release();
                    chatMessage = null;
                }
                //KSPMGlobals.Globals.KSPMServer.outgoingMessagesQueue.EnqueueCommandMessage(ref chatMessage);
            }
        }