Beispiel #1
0
        public bool open(XmlNode boxInfo)
        {
            bool flag = false;

            if (boxInfo != null)
            {
                StringTheory theory = new StringTheory("0" + this.GetConfigurationItem("max_connections", boxInfo));
                this.Config.setDatabaseType(this.GetConfigurationItem("db_type", boxInfo));
                this.Config.setDriver(this.GetConfigurationItem("driver", boxInfo));
                this.Config.setMaxConnections(theory.ToInt());
                this.Config.setServer(this.GetConfigurationItem("server", boxInfo));
                this.Config.setDatabase(this.GetConfigurationItem("database", boxInfo));
                this.Config.setUser(this.GetConfigurationItem("user", boxInfo));
                this.Config.setPassword(this.GetConfigurationItem("password", boxInfo));
                flag = this.open();
            }
            return(flag);
        }
Beispiel #2
0
        public override bool open(string configFile)
        {
            bool         flag   = false;
            StringTheory theory = new StringTheory();

            if (theory.LoadFile(configFile))
            {
                XmlDocument info = new XmlDocument();
                info.LoadXml(theory.ToString());
                if (info != null)
                {
                    StringTheory theory2 = new StringTheory("0" + this.GetConfigurationItem("max_connections", info));
                    this.Config.setDatabaseType(this.GetConfigurationItem("db_type", info.DocumentElement));
                    this.Config.setDriver(this.GetConfigurationItem("driver", info.DocumentElement));
                    this.Config.setMaxConnections(theory2.ToInt());
                    this.Config.setServer(this.GetConfigurationItem("server", info.DocumentElement));
                    this.Config.setDatabase(this.GetConfigurationItem("database", info.DocumentElement));
                    this.Config.setUser(this.GetConfigurationItem("user", info.DocumentElement));
                    this.Config.setPassword(this.GetConfigurationItem("password", info.DocumentElement));
                    flag = this.open();
                }
            }
            return(flag);
        }
 public void testToInt()
 {
     StringTheory theory = new StringTheory("056701");
     int actual = theory.ToInt();
     Assert.AreEqual(0xdd7d, actual, "strings don't match");
     theory.Renew("");
     Assert.True(0 == theory.ToInt(), "value should be zero");
 }