Exemplo n.º 1
0
        public void AddVhost(string DocRoot, string SrvName)
        {
            Symboliclink s = new Symboliclink(DocRoot);

            Vhost newVhost = new Vhost();
            newVhost.DocRoot = "\"" + s.fullPath + "\"".Trim();
            newVhost.SrvName =  SrvName.Trim();

            Vhosts.count++;
            Vhosts.vhosts.Add(newVhost);
        }
Exemplo n.º 2
0
        public void Init()
        {
            this.Clear();
            this.VhostsFile = DefaultVhostsFile;
            try
            {
                this.reader = new StreamReader(this.VhostsFile);
            }
            catch (FileNotFoundException)
            {
                Console.Error.WriteLine("nqma fail");
            }
            catch (IOException)
            {
                Console.Error.WriteLine("nemoga da otvorq faila");
            }
            using (this.reader)
            {
                string line = this.reader.ReadLine();

                while (line != null)
                {
                    int indexDocRoot = line.IndexOf("DocumentRoot");

                    string DocRoot = "";
                    string SrvName = "";

                    if (indexDocRoot != -1)
                    {
                        Vhost vhost = new Vhost();
                        DocRoot       = line.Replace("DocumentRoot", "");
                        vhost.DocRoot = DocRoot.Trim();
                        // Console.WriteLine(DocRoot);

                        line = this.reader.ReadLine();
                        int indexSrvName = line.IndexOf("ServerName");

                        if (indexSrvName != -1)
                        {
                            SrvName = line.Replace("ServerName", "");
                            //    Console.WriteLine(SrvName);
                            vhost.SrvName = SrvName.Trim();
                        }

                        Vhosts.vhosts.Add(vhost);
                        Vhosts.count++;
                    }

                    line = this.reader.ReadLine();
                }
            }
            this.reader.Close();
        }
Exemplo n.º 3
0
        public void AddVhost(string DocRoot, string SrvName)
        {
            Symboliclink s = new Symboliclink(DocRoot);

            Vhost newVhost = new Vhost();

            newVhost.DocRoot = "\"" + s.fullPath + "\"".Trim();
            newVhost.SrvName = SrvName.Trim();

            Vhosts.count++;
            Vhosts.vhosts.Add(newVhost);
        }
Exemplo n.º 4
0
        public void Init()
        {
            this.Clear();
            this.VhostsFile = DefaultVhostsFile;
            try
            {
                this.reader = new StreamReader(this.VhostsFile);
            }
            catch (FileNotFoundException)
            {
                Console.Error.WriteLine("nqma fail");
            }
            catch (IOException)
            {
                Console.Error.WriteLine("nemoga da otvorq faila");
            }
            using (this.reader)
            {
                string line = this.reader.ReadLine();

                while (line != null)
                {
                    int indexDocRoot = line.IndexOf("DocumentRoot");

                    string DocRoot = "";
                    string SrvName= "";

                    if (indexDocRoot != -1)
                    {
                        Vhost vhost = new Vhost();
                        DocRoot = line.Replace("DocumentRoot", "");
                        vhost.DocRoot = DocRoot.Trim();
                       // Console.WriteLine(DocRoot);

                        line = this.reader.ReadLine();
                        int indexSrvName = line.IndexOf("ServerName");

                        if (indexSrvName != -1)
                        {
                            SrvName = line.Replace("ServerName", "");
                        //    Console.WriteLine(SrvName);
                            vhost.SrvName = SrvName.Trim();
                        }

                        Vhosts.vhosts.Add(vhost);
                        Vhosts.count++;
                    }

                    line = this.reader.ReadLine();
                }
            }
            this.reader.Close();
        }