Esempio n. 1
0
        /*
         * Configuration
         */
        private Configuration ReadConfiguration(string configFilePath)
        {
            Configuration conf = new Configuration();

            XmlDocument configDoc = new XmlDocument();

            configDoc.Load(configFilePath + @"\" + CONFIG_FILE);

            /*
             * Read Serverport
             */
            XmlNode portNode = configDoc.DocumentElement.SelectSingleNode("ServerPort");

            if (portNode != null)
            {
                String str = portNode.InnerText.Trim();
                conf.ServerPort = Convert.ToInt32(str);
            }

            /*
             * Read Shutdown port
             */
            XmlNode sdportNode = configDoc.DocumentElement.SelectSingleNode("ShutdownPort");

            if (sdportNode != null)
            {
                String str = sdportNode.InnerText.Trim();
                conf.ShutdownPort = Convert.ToInt32(str);
            }

            /*
             * Read server name
             */
            XmlNode nameNode = configDoc.DocumentElement.SelectSingleNode("ServerName");

            if (nameNode != null)
            {
                conf.ServerName = nameNode.InnerText.Trim();
            }

            /*
             * Read Debug Level
             */
            XmlNode debugNode = configDoc.DocumentElement.SelectSingleNode("DebugLevel");

            if (debugNode != null)
            {
                string       str   = debugNode.InnerText.Trim();
                SourceLevels level = SourceLevels.All;
                SourceLevels.TryParse(str, true, out level);
                conf.DebugLevel = level;
            }

            /*
             * Read Log Files location
             */
            XmlNode logFilesNode = configDoc.DocumentElement.SelectSingleNode("LogFilesPath");

            if (debugNode != null)
            {
                conf.LogFilePath = logFilesNode.InnerText.Trim();
            }


            return(conf);
        }