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 { } } } }
private bool msg_SendTarget(String msg, String Nick, String Target, bool isEcho) { if (Chk_WisperChecker.Checked && Nick != ServerNick && isEcho != true) { Rtxt_Chat_Log.Invoke(new writeLog(writeChatLog), (Nick + " -> " + Target + " : " + msg)); } if (Nick == ServerNick) { msg = Nick + " : " + msg; } else if (isEcho) { msg = "[" + Nick + "님에게] : " + msg; } else { 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) { try { if (ClientGroup[index] != null) { if (Target == ClientGroup[index].NickName) { Thread.Sleep(SleepTime / 20); ClientGroup[index].Socket.GetStream().Write(Sending_Msg, 0, Sending_Msg.Length); return(true); } } } catch { } } return(false); }
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 { } } } }