// Method to add textspeak meaning. Searches textword csv file, and returns expanded abbreviation private string Textspeak() { var rows = File.ReadAllLines("Data/textwords.csv").Select(l => l.Split(',').ToArray()).ToArray(); // Split csv file by delimiter and add to string array // Loop iterates through string array, and checks if the textbox contains abbreviation contained // in the array. If it does, adds abbreviation and its meaning to string variable for (int i = 0; i < rows.GetLength(0); i++) { if (BodyTextBox.Contains(rows[i][0])) { newMessage = BodyTextBox.Replace(rows[i][0].ToString(), rows[i][0].ToString() + "<" + rows[i][1].ToString() + ">"); // Add abbreviation and meaning to string saveRegular = true; } } return(newMessage); // return string }
// This method splits up the information held in the bodt textbox depending on wether it // is a URL or not. If it finds a URL, it removes the URL and replaces it with a quarantined message #region Quarantine Method private string QuarantineURL() { string swap = ""; var links = BodyTextBox.Split("\t\n ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Where(s => s.StartsWith("http://") || s.StartsWith("www.") || s.StartsWith("https://") || s.StartsWith("HTTP://") || s.StartsWith("WWW.") || s.StartsWith("HTTPS://")); foreach (string s in links) { if (BodyTextBox.Contains(s)) { swap = BodyTextBox.Replace(s, "<URL Quarantined>"); saveRegular = true; } } //MessageBox.Show(swap); return(swap); }