Exemple #1
0
 private void Ok_Click(object sender, EventArgs e)
 {
     Vhosts vhostsList = new Vhosts();
     vhostsList.AddVhost(DocumentRoot.Text, ServerName.Text);
     vhostsList.ToFile();
     this.Close();
 }
Exemple #2
0
        public void ToFile()
        {
            try
            {
                this.writer = new StreamWriter(this.hostFile);
            }
            catch (FileNotFoundException)
            {
                Console.Error.WriteLine("cannot find the file");
            }
            catch (IOException)
            {
                Console.Error.WriteLine("cannot open the file");
            }

            using (this.writer)
            {
                Vhosts vhostsList = new Vhosts();
                this.writer.WriteLine("###### VhostsEditor ######");
                for (int i = 0; i < vhostsList.Count(); i++)
                {
                    this.writer.WriteLine("127.0.0.1        " + vhostsList.GetVhostSNAt(i).Trim());
                }
            }
        }
Exemple #3
0
        private void Ok_Click(object sender, EventArgs e)
        {
            Vhosts vhostsList = new Vhosts();

            vhostsList.AddVhost(DocumentRoot.Text, ServerName.Text);
            vhostsList.ToFile();
            this.Close();
        }
Exemple #4
0
        private void Ok_Click(object sender, EventArgs e)
        {
            Vhosts vhostsList = new Vhosts();
            ///vhostsList.GetVhostBySN(this.editVhostSN).DocRoot = eDocRoot.Text;
               // vhostsList.GetVhostBySN(this.editVhostSN).SrvName = eSrvName.Text;
            int position = vhostsList.GetPositionBySN(this.editVhostSN);

            vhostsList.EditVhostByPosition(position, eSrvName.Text, eDocRoot.Text);
            vhostsList.ToFile();
            this.Close();
        }
Exemple #5
0
        private void Ok_Click(object sender, EventArgs e)
        {
            Vhosts vhostsList = new Vhosts();
            ///vhostsList.GetVhostBySN(this.editVhostSN).DocRoot = eDocRoot.Text;
            // vhostsList.GetVhostBySN(this.editVhostSN).SrvName = eSrvName.Text;
            int position = vhostsList.GetPositionBySN(this.editVhostSN);

            vhostsList.EditVhostByPosition(position, eSrvName.Text, eDocRoot.Text);
            vhostsList.ToFile();
            this.Close();
        }
Exemple #6
0
        private void FillVhostsBox(Vhosts vhosts)
        {
            List<string> _items = new List<string>();

            vhosts.Init();

            for (int i = 0; i < vhosts.Count(); i++)
            {
                _items.Add(vhosts.GetVhostSNAt(i));
            }

            vhostsListBox.DataSource = _items;
        }
Exemple #7
0
        private void FillVhostsBox(Vhosts vhosts)
        {
            List <string> _items = new List <string>();

            vhosts.Init();

            for (int i = 0; i < vhosts.Count(); i++)
            {
                _items.Add(vhosts.GetVhostSNAt(i));
            }

            vhostsListBox.DataSource = _items;
        }
Exemple #8
0
        public void ToFile()
        {
            try
                {
                    this.writer = new StreamWriter(this.hostFile);
                }
                catch (FileNotFoundException)
                {
                    Console.Error.WriteLine("cannot find the file");
                }
                catch (IOException)
                {
                    Console.Error.WriteLine("cannot open the file");
                }

                using (this.writer)
                {
                    Vhosts vhostsList = new Vhosts();
                    this.writer.WriteLine("###### VhostsEditor ######");
                    for (int i = 0; i < vhostsList.Count(); i++)
                    {
                        this.writer.WriteLine("127.0.0.1        "+vhostsList.GetVhostSNAt(i).Trim());
                    }
                }
        }