private void MaterialRaisedButton2_Click(object sender, EventArgs e) { if (!String.IsNullOrWhiteSpace(NEW.Text)) { if (Base64C.IsValidUri(NEW.Text)) { if (Base64C.CheckReachableSite(NEW.Text)) { WebClient x = new WebClient(); string source = x.DownloadString($"{NEW.Text}"); string title = Regex.Match(source, @"\<title\b[^>]*\>\s*(?<Title>[\s\S]*?)\</title\>", RegexOptions.IgnoreCase).Groups["Title"].Value; Site site = new Site(title, NEW.Text); site.Show(); } else { SystemSounds.Beep.Play(); MessageBox.Show("Site does not exist!"); } } else { SystemSounds.Beep.Play(); MessageBox.Show("That is not a valid url!"); } } }
private void Encode_Click(object sender, EventArgs e) { if (!String.IsNullOrWhiteSpace(OG.Text)) { NEW.Text = Base64C.Encode(OG.Text); AddToHistory(OG.Text); } }
private void V_Click(object sender, EventArgs e) { if (!String.IsNullOrWhiteSpace(OG.Text)) { if (Base64C.IsBase64String(OG.Text)) { NEW.Text = Base64C.Decode(OG.Text); AddToHistory(NEW.Text); } else { MessageBox.Show("That is not a base64 string!"); } } }
private void PEC_Click(object sender, EventArgs e) { //Paste, Encode, Copy if (!String.IsNullOrWhiteSpace(Clipboard.GetText())) { OG.Text = Clipboard.GetText(); NEW.Text = Base64C.Encode(Clipboard.GetText()); Clipboard.SetText(NEW.Text); AddToHistory(NEW.Text); } else { SystemSounds.Hand.Play(); MessageBox.Show("That is not some text!"); } }
private void GetTitle_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex != -1) { if (Base64C.IsValidUri(listBox1.SelectedItem.ToString())) { WebClient x = new WebClient(); string source = x.DownloadString(listBox1.SelectedItem.ToString()); string title = Regex.Match(source, @"\<title\b[^>]*\>\s*(?<Title>[\s\S]*?)\</title\>", RegexOptions.IgnoreCase).Groups["Title"].Value; MessageBox.Show(title); } else { SystemSounds.Beep.Play(); MessageBox.Show("That is not a valid url!"); } } }