HostsEditorForm.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace Optimizer
  11. {
  12. public partial class HostsEditorForm : Form
  13. {
  14. string[] toSave = null;
  15. public HostsEditorForm()
  16. {
  17. InitializeComponent();
  18. Options.ApplyTheme(this);
  19. }
  20. private void HostsEditor_Load(object sender, EventArgs e)
  21. {
  22. foreach (string line in HostsHelper.ReadHosts())
  23. {
  24. textBox1.Text += line + HostsHelper.nl;
  25. }
  26. textBox1.Focus();
  27. }
  28. private void button1_Click(object sender, EventArgs e)
  29. {
  30. this.Close();
  31. }
  32. private void button7_Click(object sender, EventArgs e)
  33. {
  34. toSave = textBox1.Lines;
  35. HostsHelper.SaveHosts(toSave);
  36. this.Close();
  37. }
  38. }
  39. }