private void button47_Click(object sender, EventArgs e) { if ((txtIP.Text != string.Empty) && (txtDomain.Text != string.Empty)) { string ip = txtIP.Text.Trim(); string domain = txtDomain.Text.Trim(); string recommendeddomain = string.Empty; if (!domain.StartsWith("www.")) { recommendeddomain = "www." + domain; } else { recommendeddomain = domain.Replace("www.", string.Empty).Trim(); } HostsHelper.AddEntry(HostsHelper.SanitizeEntry(ip) + " " + HostsHelper.SanitizeEntry(domain)); if (!string.IsNullOrEmpty(recommendeddomain)) { HostsHelper.AddEntry(HostsHelper.SanitizeEntry(ip) + " " + HostsHelper.SanitizeEntry(recommendeddomain)); } GetHostsEntries(); txtIP.Clear(); txtDomain.Clear(); chkBlock.Checked = false; } }
private void button7_Click(object sender, EventArgs e) { _toSave = textBox1.Lines; HostsHelper.SaveHosts(_toSave); this.Close(); }
private void HostsEditor_Load(object sender, EventArgs e) { foreach (string line in HostsHelper.ReadHosts()) { textBox1.Text += line + HostsHelper.NewLine; } textBox1.Focus(); }
public HostsEditorForm() { InitializeComponent(); Options.ApplyTheme(this); if (HostsHelper.GetReadOnly()) { savebtn.Enabled = false; } }
private void button42_Click(object sender, EventArgs e) { if (hl.SelectedItems.Count == 1) { string temp = hl.SelectedItem.ToString().Replace(" : ", " "); HostsHelper.RemoveEntry(temp); GetHostsEntries(); } }
private void HostsEditor_Load(object sender, EventArgs e) { //foreach (string line in HostsHelper.ReadHosts()) //{ // textBox1.Text += line + HostsHelper.NewLine; //} textBox1.Text = HostsHelper.ReadHostsFast(); textBox1.Focus(); }
internal void RemoveAllHostsEntries() { List <string> collection = new List <string>(); foreach (string item in hl.Items) { collection.Add(item.Replace(" : ", " ")); } HostsHelper.RemoveAllEntries(collection); GetHostsEntries(); }
private void GetHostsEntries() { entries = HostsHelper.GetEntries(); hl.Items.Clear(); for (int i = 0; i < entries.Count; i++) { if (!string.IsNullOrEmpty(entries[i])) { hl.Items.Add(entries[i]); } } }
private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { HostsHelper.RestoreDefaultHosts(); GetHostsEntries(); }
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { HostsHelper.LocateHosts(); }