Beispiel #1
0
        /// <summary>
        /// 从GloableSetting中读取LicenseServer信息
        /// </summary>
        /// <returns></returns>
        public List <LicenseServer> GetLicenseServersOnUMPServer()
        {
            List <LicenseServer> lstServers = new List <LicenseServer>();

            try
            {
                XmlNode       serversNode             = xmlOperator.SelectNode("Parameters02/LicenseServer", "");
                LicenseServer server                  = null;
                string        LStrVerificationCode001 = Common.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M101);
                foreach (XmlNode node in serversNode.ChildNodes)
                {
                    if (!node.Name.Equals("LicServer"))
                    {
                        continue;
                    }
                    server = new LicenseServer();
                    int iEnable = int.Parse(EncryptionAndDecryption.EncryptDecryptString(xmlOperator.SelectAttrib(node, "P02"), LStrVerificationCode001, EncryptionAndDecryption.UMPKeyAndIVType.M101));
                    if (iEnable == 1)
                    {
                        server        = new LicenseServer();
                        server.IsMain = int.Parse(xmlOperator.SelectAttrib(node, "P01"));
                        server.Host   = EncryptionAndDecryption.EncryptDecryptString(xmlOperator.SelectAttrib(node, "P03"), LStrVerificationCode001, EncryptionAndDecryption.UMPKeyAndIVType.M101);
                        server.Port   = int.Parse(EncryptionAndDecryption.EncryptDecryptString(xmlOperator.SelectAttrib(node, "P04"), LStrVerificationCode001, EncryptionAndDecryption.UMPKeyAndIVType.M101));
                        lstServers.Add(server);
                    }
                }
            }
            catch (Exception ex)
            {
                UMPService00.WriteLog("GetLicenseServersOnUMPServer() " + ex.Message);
            }
            return(lstServers);
        }
Beispiel #2
0
        /// <summary>
        /// 从umpparam_simp.xml中读取License信息
        /// </summary>
        /// <returns></returns>
        public List <LicenseServer> GetLicenseServerOnVoiceServer()
        {
            List <LicenseServer> lstServers = new List <LicenseServer>();

            try
            {
                XmlNode       serversNode             = xmlOperator.SelectNode("Configurations/Configuration/Sites/Site/Resources/LicenseServers", "");
                LicenseServer server                  = null;
                string        LStrVerificationCode001 = Common.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M101);
                if (serversNode == null)
                {
                    return(lstServers);
                }
                string strEnable      = string.Empty;
                string strHostAddress = string.Empty;
                string strPort        = string.Empty;
                foreach (XmlNode node in serversNode.ChildNodes)
                {
                    if (!node.Name.Equals("LicenseServer"))
                    {
                        continue;
                    }
                    strEnable = xmlOperator.SelectAttrib(node, "Enable");
                    if (!strEnable.Equals("1"))
                    {
                        continue;
                    }
                    server = new LicenseServer();
                    bool bLicIsNotNul = false;
                    foreach (XmlNode nodeChild in node.ChildNodes)
                    {
                        bLicIsNotNul = false;
                        if (nodeChild.Name.Equals("HostAddress"))
                        {
                            strHostAddress = xmlOperator.SelectAttrib(nodeChild, "Value");
                            if (string.IsNullOrEmpty(strHostAddress))
                            {
                                UMPService00.WriteLog("GetLicenseServerOnVoiceServer4 ");
                                break;
                            }
                        }
                        if (nodeChild.Name.Equals("HostPort"))
                        {
                            strPort = xmlOperator.SelectAttrib(nodeChild, "Value");
                            if (string.IsNullOrEmpty(strPort))
                            {
                                UMPService00.WriteLog("GetLicenseServerOnVoiceServer5 ");
                                break;
                            }
                        }
                        bLicIsNotNul = true;
                    }
                    if (bLicIsNotNul)
                    {
                        server.Host = EncryptionAndDecryption.EncryptDecryptString(strHostAddress, LStrVerificationCode001, EncryptionAndDecryption.UMPKeyAndIVType.M101);
                        server.Port = int.Parse(EncryptionAndDecryption.EncryptDecryptString(strPort, LStrVerificationCode001, EncryptionAndDecryption.UMPKeyAndIVType.M101));
                        lstServers.Add(server);
                    }
                }
            }
            catch (Exception ex)
            {
                UMPService00.WriteLog("GetLicenseServerOnVoiceServer() " + ex.Message);
            }
            return(lstServers);
        }