예제 #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);
        }
예제 #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();
        }
예제 #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);
        }
예제 #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();
        }