예제 #1
0
        public static void Run()
        {
            if (ConfigCheck.IsExist)
            {
                return;
            }
            string text = AppDomain.CurrentDomain.BaseDirectory + "AutoManage.config";

            if (!File.Exists(text))
            {
                ConfigCheck.WriteFile(text);
                throw new ArgumentException("Please configure the connection parameters in the project root path in \"" + text + "\"!");
            }
            ConfigCheck.IsExist = true;
        }
예제 #2
0
        static SqlServerConfig()
        {
            SqlServerConfig.ConfigPath = AppDomain.CurrentDomain.BaseDirectory + "AutoManage.config";
            SqlServerConfig.mysqlHT    = new Hashtable();
            ConfigCheck.Run();
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.Load(SqlServerConfig.ConfigPath);
            XmlNodeList xmlNodeList = xmlDocument.SelectNodes("/root/sql/key");

            foreach (XmlNode xmlNode in xmlNodeList)
            {
                string key = xmlNode.Attributes["name"].Value.ToLower();
                if (!SqlServerConfig.mysqlHT.Contains(key))
                {
                    SqlServerConfig.mysqlHT.Add(key, xmlNode.Attributes["value"].Value);
                }
            }
        }