/// <summary> /// 在Voice服务器上创建UMP网站的地址和端口 /// </summary> /// <param name="strWebSiteHost"></param> /// <param name="iIISPort"></param> /// <returns></returns> public bool WriteWebSiteInfoOnVoiceServer(string strWebSiteHost, int iIISPort) { bool bIsSucccess = false; try { XmlNode IISNode = xmlOperator.SelectNode("UMPSetted/IISBindingProtocol", ""); if (IISNode == null) { XmlNode rootNode = xmlOperator.SelectNode("UMPSetted", ""); IISNode = xmlOperator.InsertNode("IISBindingProtocol", rootNode); } bool bIsExistsBinding = false; foreach (XmlNode node in IISNode.ChildNodes) { if (node.Name.Equals("ProtocolBind")) { if (xmlOperator.SelectAttrib(node, "Used") == "1") { bIsExistsBinding = true; xmlOperator.UpdateAttrib(node, "BindInfo", iIISPort.ToString()); xmlOperator.UpdateAttrib(node, "IPAddress", strWebSiteHost); xmlOperator.Save(strFileName); break; } } } //如果不存在ProtocolBind节点 则增加 if (!bIsExistsBinding) { XmlNode node = xmlOperator.InsertNode("ProtocolBind", IISNode); List <AttribEntry> lstAttribs = new List <AttribEntry>(); lstAttribs.Add(new AttribEntry("BindInfo", iIISPort.ToString())); lstAttribs.Add(new AttribEntry("IPAddress", strWebSiteHost)); lstAttribs.Add(new AttribEntry("Used", "1")); xmlOperator.InsertAttribs(node, lstAttribs); xmlOperator.Save(strFileName); } bIsSucccess = true; } catch (Exception ex) { UMPService00.WriteLog("WriteWebSiteInfoOnVoiceServer() error : " + ex.Message); } return(bIsSucccess); }
/// <summary> /// 在voice服务器上生成数据库连接的xml /// </summary> /// <param name="dbInfo"></param> /// <returns></returns> public static bool WriteDBInfoInVoiceServer(DatabaseInfo dbInfo, string strPath) { bool isSuccess = false; try { string strXmlFileDir = strPath + "\\UMP.Server"; string strXmlFileName = "Args01.UMP.xml"; XmlDocument xmlDoc = Common.CreateXmlDocumentIfNotExists(strXmlFileDir, strXmlFileName, "DatabaseParameters"); XMLOperator xmlOperator = new XMLOperator(xmlDoc); XmlNode paramNode = xmlOperator.SelectNode("DatabaseParameters", ""); bool bIsExistsDB = false; foreach (XmlNode node in paramNode) { if (node.Name == "Database") { string strIsUsed = xmlOperator.SelectAttrib(node, "P03"); string LStrVerificationCode = Common.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104); strIsUsed = EncryptionAndDecryption.EncryptDecryptString(strIsUsed, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M104); if (strIsUsed == "1") { bIsExistsDB = true; LStrVerificationCode = Common.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M004); xmlOperator.UpdateAttrib(node, "P02", dbInfo.TypeID.ToString()); xmlOperator.UpdateAttrib(node, "P03", EncryptionAndDecryption.EncryptDecryptString("1", LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M004)); xmlOperator.UpdateAttrib(node, "P04", EncryptionAndDecryption.EncryptDecryptString(dbInfo.Host, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M004)); xmlOperator.UpdateAttrib(node, "P05", EncryptionAndDecryption.EncryptDecryptString(dbInfo.Port.ToString(), LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M004)); xmlOperator.UpdateAttrib(node, "P06", EncryptionAndDecryption.EncryptDecryptString(dbInfo.DBName, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M004)); xmlOperator.UpdateAttrib(node, "P07", EncryptionAndDecryption.EncryptDecryptString(dbInfo.LoginName, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M004)); xmlOperator.UpdateAttrib(node, "P08", EncryptionAndDecryption.EncryptDecryptString(dbInfo.Password, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M004)); xmlOperator.UpdateAttrib(node, "P10", dbInfo.TypeName); xmlOperator.Save(strXmlFileDir + "\\" + strXmlFileName); break; } } } if (!bIsExistsDB) { string LStrVerificationCode = Common.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M004); XmlNode DatabaseNode = xmlOperator.InsertNode("Database", paramNode); List <AttribEntry> lstAttribs = new List <AttribEntry>(); lstAttribs.Add(new AttribEntry("P01", "1")); lstAttribs.Add(new AttribEntry("P02", dbInfo.TypeID.ToString())); lstAttribs.Add(new AttribEntry("P03", EncryptionAndDecryption.EncryptDecryptString("1", LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M004))); lstAttribs.Add(new AttribEntry("P04", EncryptionAndDecryption.EncryptDecryptString(dbInfo.Host, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M004))); lstAttribs.Add(new AttribEntry("P05", EncryptionAndDecryption.EncryptDecryptString(dbInfo.Port.ToString(), LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M004))); lstAttribs.Add(new AttribEntry("P06", EncryptionAndDecryption.EncryptDecryptString(dbInfo.DBName, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M004))); lstAttribs.Add(new AttribEntry("P07", EncryptionAndDecryption.EncryptDecryptString(dbInfo.LoginName, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M004))); lstAttribs.Add(new AttribEntry("P08", EncryptionAndDecryption.EncryptDecryptString(dbInfo.Password, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M004))); lstAttribs.Add(new AttribEntry("P09", "")); lstAttribs.Add(new AttribEntry("P10", dbInfo.TypeName)); xmlOperator.InsertAttribs(DatabaseNode, lstAttribs); xmlOperator.Save(strXmlFileDir + "\\" + strXmlFileName); } isSuccess = true; } catch (Exception ex) { isSuccess = false; } return(isSuccess); }