Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Text.RegularExpressions;
- namespace AUTOMATA_ChatBox
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private string FilterWord(string text)
- {
- string pattern = @"([yY\s]+[aA@4\s]+[wW\s]+[aA@4]+)|" +
- @"([aA@4\s]+[wW\s]+[aA@4\s]+[yY]+)|" +
- @"([bB\s]+[oOuU0\s]+[aA@4\s]+[nN\s]+[gG6]+)|" +
- @"([nN\s]+[gG6\s]+[aA@4\s]+[oOuU0\s]+[bB]+)|" +
- @"([pP\s]+[iI1!\s]+[sS5$&zZ\s]+[tT+\s]+[iI1!]+)|" +
- @"([iI1!\s]+[tT+\s]+[sS5$&zZ\s]+[iI1!\s]+[pP]+)|" +
- @"([fF\s]+[uUvV\s]+[cC(<\s]+[kK]+)|" +
- @"([kK\s]+[cC(<\s]+[uUvV\s]+[fF]+)";
- string replace = string.Empty;
- Regex reg = new Regex(pattern);
- int i = 0;
- while (i <= reg.Match(text, 0, text.Length).Length - 1)
- {
- replace += "*";
- i++;
- }
- return reg.Replace(text, replace);
- }
- private bool IsInvalidWord(string invalid)
- {
- return true;
- }
- private void btnSend_Click(object sender, EventArgs e)
- {
- int flag = IsInvalidWord(FilterWord(txttext.Text)) ? 1 : 0;
- switch (flag)
- {
- case 0:
- if (IsInvalidWord(FilterWord(txttext.Text)))
- {
- goto default;
- }
- else
- {
- rtbdispaly.Text += "\r\n>>" + txttext.Text;
- }
- break;
- default:
- rtbdispaly.Text += "\r\n>>" + FilterWord(txttext.Text);
- break;
- }
- rtbdispaly.SelectionStart = rtbdispaly.Text.Length;
- rtbdispaly.ScrollToCaret();
- txttext.Clear();
- txttext.Focus();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement