public void SendToIrc(string s, bool iscommand = false) { if (ThIrc == null) { return; } string[] r = s.Split(new string[] { "/", " " }, StringSplitOptions.None); _output = new StreamWriter(_sock.GetStream()); try { // check se for comando if (iscommand) { if (r[0] == @"QUIT") { Application.Current.Dispatcher.Invoke( DispatcherPriority.Normal, (Action) delegate { _output.Write("QUIT" + "\r\n"); _output.Flush(); // //_Quit(); ListChat.Items.Clear(); CanvasWelcome.Visibility = Visibility.Visible; CanvasContent.Visibility = Visibility.Hidden; TxtSend.Visibility = Visibility.Collapsed; CanvasProgressring.Visibility = Visibility.Collapsed; RingP.IsActive = false; // mensagem de boas vindas Effectfade(LblChan, Efeitos.Surgir, Resources.MergedDictionaries[0]["Status"].ToString(), 5, Color.DodgerBlue); Title = Resources.MergedDictionaries[0]["Status"].ToString(); }); return; } switch (r[1]) { // AUTH case "AUTH": string[] content = s.Split(new string[] { " ", "/" }, StringSplitOptions.None); _output.Write(@"AUTH " + content[2] + @" " + content[3] + "\r\n"); _output.Flush(); MyDelegates.OnChatCallBack(@"system :", "Auth Sucess"); break; // kick => KICK <#channel> <nick> <comment banned> // exemplo : /KICK usuario comentario case "KICK": string[] k = s.Split(new string[] { "/", " " }, StringSplitOptions.None); _output.Write(@"KICK " + MainWindow.Configuration.StConfiguration.Channel + " " + k[2] + " " + k[3] + "\r\n"); _output.Flush(); break; // autokick // exemplo : /ADDKICK usuario case "ADDKICK": string[] ak = s.Split(new string[] { "/", " " }, StringSplitOptions.None); if (ak[2] != string.Empty) { Autokick.AddUser(ak[2]); } break; // removeautokick // ex: /REMOVEAUTOKICK usuario case "REMOVEKICK": string[] rk = s.Split(new string[] { "/", " " }, StringSplitOptions.None); if (rk[2] != string.Empty) { Autokick.RemoveUser(rk[2]); } break; // clearall // ex: /CLEARAUTOKICK case "CLEARKICK": Autokick.ClearAll(); break; // clear chat client // exemplo : /CLEAR case "CLEAR": Application.Current.Dispatcher.Invoke( DispatcherPriority.Normal, (Action) delegate { ListChat.Items.Clear(); MyDelegates.OnChatCallBack(@"system :", @"clean client chat"); }); break; // envia comando TCP direto // exemplos no site quakenet => https://www.quakenet.org/help/q-commands case "CMD": Application.Current.Dispatcher.Invoke( DispatcherPriority.Normal, (Action) delegate { _output.Write(s.Replace("/CMD", string.Empty) + "\r\n"); _output.Flush(); }); break; // Debug Show and Hide case "DEBUGON": Showconsole.ShowConsole(); break; case "DEBUGOFF": Showconsole.ShowConsole(false); break; } return; } _output.Write("PRIVMSG " + Configuration.StConfiguration.Channel + " : " + s + "\r\n"); _output.Flush(); MyDelegates.OnChatCallBack(@"system :", s); } catch (Exception ex) { MyDelegates.OnDebugMessageCallBack(ex.StackTrace); } }