Esempio n. 1
0
File: Main.cs Progetto: burstas/rmps
        /// <summary>
        /// 方案管理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MiSaveasSlnClick(object sender, EventArgs e)
        {
            SolutionEditer editer = new SolutionEditer(_Solutions);
            if (DialogResult.OK != editer.ShowDialog(this))
            {
                return;
            }

            _Solution.Text = editer.Solution;
            Saveas(_HostsFile);
            Backup();

            if (!string.IsNullOrWhiteSpace(_Solution.Text))
            {
                Text = _Solution.Text + " - MyHosts";
            }

            AppendSolution(_Solution, true);
        }
Esempio n. 2
0
File: Main.cs Progetto: burstas/rmps
        public void CreateSolution()
        {
            SolutionEditer editer = new SolutionEditer(_Solutions);
            if (DialogResult.OK != editer.ShowDialog(this))
            {
                return;
            }

            Backup();

            string key = editer.Solution;
            _Solution.Key = key;
            _Solution.Text = key;
            StreamWriter writer = new StreamWriter(_HostsFile);
            _Solution.Save(writer);
            writer.WriteLine("# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.");
            writer.WriteLine("#");
            writer.WriteLine("# This file contains the mappings of IP addresses to host names. Each");
            writer.WriteLine("# entry should be kept on an individual line. The IP address should");
            writer.WriteLine("# be placed in the first column followed by the corresponding host name.");
            writer.WriteLine("# The IP address and the host name should be separated by at least one");
            writer.WriteLine("# space.");
            writer.WriteLine("#");
            writer.WriteLine("# Additionally, comments (such as these) may be inserted on individual");
            writer.WriteLine("# lines or following the machine name denoted by a '#' symbol.");
            writer.WriteLine("#");
            writer.WriteLine("# For example:");
            writer.WriteLine("#");
            writer.WriteLine("#      102.54.94.97     rhino.acme.com          # source server");
            writer.WriteLine("#       38.25.63.10     x.acme.com              # x client host");
            writer.WriteLine("#");
            writer.WriteLine("# localhost name resolution is handled within DNS itself.");
            writer.WriteLine("#	127.0.0.1       localhost");
            writer.WriteLine("#	::1             localhost");
            writer.Close();

            AppendSolution(_Solution, true);
            Reload();
        }