/// <summary>
        ///  return connstring from formatted of xml file
        /// 返回XML文件指定元素属性连接字符串
        /// </summary>
        /// <param name="fileName">XMl file path</param>
        /// <param name="xmlElement">XML element name</param>
        /// <param name="xmlAttribute">XML Attribute name</param>
        /// <returns></returns>
        public static String GetDbConfigXml(String fileName, String xmlElement, String xmlAttribute)
        {
            String s = XmlStream.getXmlValue(fileName, xmlElement, xmlAttribute);

            if (string.IsNullOrEmpty(s))
            {
                throw new Exception("XML Attribute not found");
            }
            return(s);
        }
Esempio n. 2
0
        /// <GetConnectionString>
        /// GetConnectionString
        /// </GetConnectionString>
        /// <returns></returns>
        public SQLServerDatabase(String ConnectName, StringEncrypt.EncryptType type)
        {
            String EncryptString = XmlStream.getXmlValue(AppDomain.CurrentDomain.BaseDirectory + "DatabaseConfig.xml", ConnectName, "ConnectString");

            if (type != StringEncrypt.EncryptType.None)
            {
                ConnectString = StringEncrypt.DataDecrypt(type, EncryptString);
            }
            else
            {
                ConnectString = EncryptString;
            }
        }
        /// <summary>
        ///  return connstring from formatted of xml file
        /// 返回XML文件指定元素属性加密方式连接字符串
        /// </summary>
        /// <param name="fileName">XMl file path</param>
        /// <param name="xmlElement">XML element name</param>
        /// <param name="xmlAttribute">XML Attribute name</param>
        /// <param name="encryptType">String Encrypt</param>
        /// <returns></returns>
        public static String GetDbConfigXml(String fileName, String xmlElement, String xmlAttribute, StringEncrypt.EncryptType encryptType)
        {
            String s = XmlStream.getXmlValue(fileName, xmlElement, xmlAttribute);

            if (string.IsNullOrEmpty(s))
            {
                throw  new Exception("XML Attribute not found");
            }
            if (encryptType != StringEncrypt.EncryptType.None)
            {
                s = StringEncrypt.DataDecrypt(encryptType, s);
            }
            return(s);
        }
Esempio n. 4
0
        /// <summary>
        /// 计算解密密匙
        /// </summary>
        /// <returns></returns>
        private static String GetEncryptKey()
        {
            try
            {
                if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "DatabaseCon.xml"))
                {
                    string s = XmlStream.getXmlValue(AppDomain.CurrentDomain.BaseDirectory + "DatabaseCon.xml", "String", "Value");

                    s = AESDecrypt(s, "Database");

                    return(GetMD5Hash(s).Substring(0, 8));
                }
                else
                {
                    return("RBACSkey");
                }
            }
            catch (Exception)
            {
                return("RBACSkey");
            }
        }
Esempio n. 5
0
 /// <GetConnectionString>
 /// GetConnectionString
 /// </GetConnectionString>
 /// <returns></returns>
 public SQLServerDatabase(String ConnectName)
 {
     ConnectString = XmlStream.getXmlValue(AppDomain.CurrentDomain.BaseDirectory + "DatabaseConfig.xml", ConnectName, "ConnectString");
 }
Esempio n. 6
0
 /// <GetConnectionString>
 /// GetConnectionString
 /// </GetConnectionString>
 /// <returns></returns>
 public OracleDatabase()
 {
     ConnectString = XmlStream.getXmlValue(AppDomain.CurrentDomain.BaseDirectory + "DatabaseConfig.xml", "Oracle", "ConnectString");
 }
Esempio n. 7
0
 /// <GetConnectionString>
 /// GetConnectionString
 /// </GetConnectionString>
 /// <returns></returns>
 public RedisDBDatabase()
 {
     ConnectString = XmlStream.getXmlValue(AppDomain.CurrentDomain.BaseDirectory + "DatabaseConfig.xml", "MongoDB", "ConnectString");
 }
 /// <GetConnectionString>
 /// GetConnectionString
 /// </GetConnectionString>
 /// <returns></returns>
 public PostgreSQL()
 {
     ConnectString = XmlStream.getXmlValue(AppDomain.CurrentDomain.BaseDirectory + "DatabaseConfig.xml", "PostgreSQL", "ConnectString");
 }