Ejemplo n.º 1
0
        private void msg_NoticeAll(String msg, String NotSendTargetsNick)
        {
            NetworkStream NS;

            Rtxt_Chat_Log.Invoke(new writeLog(writeChatLog), (ServerNick + " : " + msg));

            msg = ServerNick + " : " + msg;
            msg = "" + (char)0x0002 + Convert.ToChar(msg.Length * 2) + (char)0x0000 + msg + (char)0x0003;


            byte[] Sending_Msg = Encoding.Unicode.GetBytes(msg); // 문자열을 아스키형 바이트로 형변환

            for (int index = 0; index < MaxConnectable; ++index)
            {
                if (ClientGroup[index] != null)
                {
                    if (ClientGroup[index].NickName == NotSendTargetsNick)
                    {
                        continue;
                    }
                    try
                    {
                        if (ClientGroup[index] != null)
                        {
                            NS = ClientGroup[index].Socket.GetStream();
                            Thread.Sleep(SleepTime);
                            NS.Write(Sending_Msg, 0, Sending_Msg.Length);
                        }
                    }
                    catch { }
                }
            }
        }
Ejemplo n.º 2
0
        private void msg_SendAll(String msg, String Nick)
        {
            NetworkStream NS;

            Rtxt_Chat_Log.Invoke(new writeLog(writeChatLog), (Nick + " : " + msg));

            msg = Nick + " : " + msg;
            msg = "" + (char)0x0002 + Convert.ToChar(msg.Length * 2) + (char)0x0000 + msg + (char)0x0003;


            byte[] Sending_Msg = Encoding.Unicode.GetBytes(msg); // 문자열을 아스키형 바이트로 형변환

            for (int index = 0; index < MaxConnectable; ++index)
            {
                if (ClientGroup[index] != null)
                {
                    if (ClientGroup[index].NickName == Nick)
                    {
                        continue;
                    }
                    try
                    {
                        if (ClientGroup[index] != null)
                        {
                            if (Nick == ServerNick && CLB_ConnectedList.GetItemChecked(index) != false)
                            {
                                NS = ClientGroup[index].Socket.GetStream();
                                Thread.Sleep(SleepTime);
                                NS.Write(Sending_Msg, 0, Sending_Msg.Length);
                            }
                            else if (chk_Chat_Allow.Checked && Nick != ServerNick)
                            {
                                NS = ClientGroup[index].Socket.GetStream();
                                Thread.Sleep(SleepTime);
                                NS.Write(Sending_Msg, 0, Sending_Msg.Length);
                            }
                        }
                    }
                    catch { }
                }
            }
        }