private void LoadPublicAgents(string filePath, out List <AgentInfo> publicAgents) { int num = 20; if (string.IsNullOrEmpty(filePath)) { publicAgents = new List <AgentInfo>(); return; } for (;;) { XmlDocument xmlDocument = new SafeXmlDocument(); xmlDocument.Schemas = MExConfiguration.Schemas; try { using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { xmlDocument.Load(fileStream); xmlDocument.Validate(delegate(object sender, ValidationEventArgs args) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile(filePath), args.Exception); }); this.LoadSettings(xmlDocument.SelectSingleNode("/configuration/mexRuntime/settings")); this.LoadMonitoringOptions(xmlDocument.SelectSingleNode("/configuration/mexRuntime/monitoring")); publicAgents = this.LoadAgentList(xmlDocument.SelectSingleNode("/configuration/mexRuntime/agentList"), false); } } catch (XmlException innerException) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile(filePath), innerException); } catch (FormatException innerException2) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile(filePath), innerException2); } catch (UnauthorizedAccessException innerException3) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile(filePath), innerException3); } catch (IOException innerException4) { if (num <= 0) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile(filePath), innerException4); } num--; Thread.Sleep(50); continue; } break; } }
// Token: 0x06000A7A RID: 2682 RVA: 0x00028ED0 File Offset: 0x000270D0 internal static SafeXmlDocument GetManifest(SafeXmlDocument xmlDoc) { if (ExtensionDataHelper.xmlSchemaSet.Count == 0) { ExtensionDataHelper.xmlSchemaSet = new XmlSchemaSet(); foreach (string text in SchemaConstants.SchemaNamespaceUriToFile.Keys) { string schemaUri = Path.Combine(ExchangeSetupContext.InstallPath, "bin", SchemaConstants.SchemaNamespaceUriToFile[text]); ExtensionDataHelper.xmlSchemaSet.Add(text, schemaUri); } } xmlDoc.Schemas = ExtensionDataHelper.xmlSchemaSet; xmlDoc.Validate(new ValidationEventHandler(ExtensionDataHelper.InvalidManifestEventHandler)); string uri; string text2; if (!ExtensionDataHelper.TryGetOfficeAppSchemaInfo(xmlDoc, "http://schemas.microsoft.com/office/appforoffice/", out uri, out text2)) { throw new OwaExtensionOperationException(Strings.ErrorInvalidManifestData(Strings.ErrorReasonManifestSchemaUnknown)); } XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(xmlDoc.NameTable); xmlNamespaceManager.AddNamespace("owe", uri); SafeXmlDocument safeXmlDocument = null; string xpath = "//owe:OfficeApp"; XmlNode xmlNode = xmlDoc.SelectSingleNode(xpath, xmlNamespaceManager); if (xmlNode != null) { safeXmlDocument = new SafeXmlDocument(); safeXmlDocument.PreserveWhitespace = true; safeXmlDocument.LoadXml(xmlNode.OuterXml); } return(safeXmlDocument); }
protected override XmlDocument WindowsLiveIdMethod(LiveIdInstanceType liveIdInstanceType) { XmlDocument xmlDocument = null; using (AppIDServiceAPISoapServer appIDServiceAPISoapServer = LiveServicesHelper.ConnectToAppIDService(liveIdInstanceType)) { base.WriteVerbose(Strings.AppIDServiceUrl(appIDServiceAPISoapServer.Url.ToString())); if (!string.IsNullOrEmpty(this.Uri)) { new Uri(this.Uri, UriKind.RelativeOrAbsolute); string text = string.Format(GetWindowsLiveIdApplicationIdentity.AppIDFindTemplate, this.Uri); string xml = appIDServiceAPISoapServer.FindApplication(text); XmlDocument xmlDocument2 = new SafeXmlDocument(); xmlDocument2.LoadXml(xml); XmlNode xmlNode = xmlDocument2.SelectSingleNode("AppidData/Application/ID"); if (xmlNode == null) { base.WriteVerbose(Strings.AppIdElementIsEmpty); throw new LiveServicesException(Strings.AppIdElementIsEmpty); } base.WriteVerbose(Strings.FoundAppId(xmlNode.InnerText)); this.AppId = xmlNode.InnerText; } if (!string.IsNullOrEmpty(this.AppId)) { xmlDocument = new SafeXmlDocument(); xmlDocument.LoadXml(appIDServiceAPISoapServer.GetApplicationEntity(new tagPASSID(), this.AppId)); } } return(xmlDocument); }
void Sign(MemoryStream memoryStream) { memoryStream.Position = 0; SafeXmlDocument document = new SafeXmlDocument(); document.PreserveWhitespace = true; document.Load(memoryStream); WSSecurityUtilityIdSignedXml signedXml = new WSSecurityUtilityIdSignedXml(document); signedXml.SignedInfo.CanonicalizationMethod = SignedXml.XmlDsigExcC14NTransformUrl; //signedXml.AddReference("/soap:Envelope/soap:Header/t:ExchangeImpersonation"); signedXml.AddReference("/soap:Envelope/soap:Header/wsse:Security/wsu:Timestamp"); signedXml.KeyInfo.AddClause(this.keyInfoNode); { signedXml.ComputeSignature(hashedAlgorithm); } XmlElement signature = signedXml.GetXml(); XmlNode wssecurityNode = document.SelectSingleNode( "/soap:Envelope/soap:Header/wsse:Security", WSSecurityBasedCredentials.NamespaceManager); wssecurityNode.AppendChild(signature); memoryStream.Position = 0; document.Save(memoryStream); }
private void LoadInternalAgents(out List <AgentInfo> preExecutionInternalAgents, out List <AgentInfo> postExecutionInternalAgents) { preExecutionInternalAgents = new List <AgentInfo>(); postExecutionInternalAgents = new List <AgentInfo>(); try { XmlDocument xmlDocument = new SafeXmlDocument(); xmlDocument.Schemas = MExConfiguration.InternalSchemas; Assembly executingAssembly = Assembly.GetExecutingAssembly(); using (Stream manifestResourceStream = executingAssembly.GetManifestResourceStream("internalAgents.config")) { xmlDocument.Load(manifestResourceStream); xmlDocument.Validate(delegate(object sender, ValidationEventArgs args) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile("internalAgents.config"), args.Exception); }); string xmlMarkups = this.GetXmlMarkups(this.exchangeSku, this.transportProcessRole); if (xmlMarkups != null) { preExecutionInternalAgents = this.LoadAgentList(xmlDocument.SelectSingleNode("/internalConfiguration/internalMexRuntime/" + xmlMarkups + "/preExecution"), true); postExecutionInternalAgents = this.LoadAgentList(xmlDocument.SelectSingleNode("/internalConfiguration/internalMexRuntime/" + xmlMarkups + "/postExecution"), true); } } } catch (XmlException innerException) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile("internalAgents.config"), innerException); } catch (UnauthorizedAccessException innerException2) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile("internalAgents.config"), innerException2); } catch (IOException innerException3) { throw new ExchangeConfigurationException(MExRuntimeStrings.InvalidConfigurationFile("internalAgents.config"), innerException3); } }
/// <summary> /// 发送短信 /// </summary> /// <param name="Phone"></param> /// <param name="Number"></param> /// <param name="num"></param> /// <param name="AdminHotelid"></param> /// <returns></returns> public static bool SendSms(string Phone, string Number, int num, string AdminHotelid) { string content = ""; string HotelName = ""; string SendMoney = "0.08"; string sql_name = string.Format(@"SELECT Name from Hotel_Admin where AdminHotelid='{0}'", AdminHotelid); DataTable ds_name = DataFactory.SqlDataBase().GetDataTableBySQL(new StringBuilder(sql_name)); if (ds_name != null && ds_name.Rows.Count > 0) { HotelName = ds_name.Rows[0]["Name"].ToString(); } string sql = string.Format(@"SELECT ID , Userid , Account , Password , URL , OrganizationID , Name , SingleMoney , AdminHotelid from SmsParameter where AdminHotelid='{0}'", AdminHotelid); DataTable ds = DataFactory.SqlDataBase().GetDataTableBySQL(new StringBuilder(sql)); if (ds != null && ds.Rows.Count > 0) { SendMoney = ds.Rows[0]["SingleMoney"].ToString(); //if (num == 1) //{ // content = "您正在" + HotelName + "进行免费注册验证,验证码:" + Number + ",请输入验证码完成注册。【" + ds.Rows[0]["name"] + "】"; // if (AdminHotelid == "1") // { // content = "您正在" + HotelName + "进行登录,验证码:" + Number + ",请输入验证码完成登录。【" + ds.Rows[0]["name"] + "】"; // } //} //else if (num == 2) //{ // content = "你在" + HotelName + "进行了修改手机绑定,验证码:" + Number + ",请输入验证码完成修改。【" + ds.Rows[0]["name"] + "】"; //} //else if (num == 3) //{ // content = "您正在" + HotelName + "进行免费注册验证,验证码:" + Number + ",请输入验证码完成注册。【" + ds.Rows[0]["name"] + "】"; //} //else if (num == 4) //{ // content = Number; //} //else if (num == 5) //{ // content = "您正在智订云进行了忘记密码,验证码:" + Number + ",请输入验证码完成修改。【智订云】"; //} if (num == 1) { content = "您正在智订云移动PMS进行免费注册验证,验证码:" + Number + ",请输入验证码完成注册。【智订云】"; if (AdminHotelid == "1") { content = "您正在登录智订云移动PMS,验证码:" + Number + ",请按页面提示进行输入。【智订云】"; } } else if (num == 2) { content = "你在智订云移动PMS进行了修改手机绑定,验证码:" + Number + ",请输入验证码完成修改。【智订云】"; } else if (num == 3) { content = "您正在智订云移动PMS进行免费注册验证,验证码:" + Number + ",请输入验证码完成注册。【智订云】"; } else if (num == 4) { content = Number; } else if (num == 5) { content = "您正在智订云进行了忘记密码,验证码:" + Number + ",请输入验证码完成修改。【智订云】"; } string param = "action=send&userid=" + ds.Rows[0]["Userid"] + "&account=" + ds.Rows[0]["account"] + "&password="******"password"] + "&mobile=" + Phone + "&content=" + EncodeConver(content); string url = ds.Rows[0]["url"].ToString(); string result = TemplateMessage.PostWebRequest(url, param); SafeXmlDocument xmlDoc = new SafeXmlDocument(); try { xmlDoc.LoadXml(result); //读取Activity节点下的数据。SelectSingleNode匹配第一个Activity节点 XmlNode root = xmlDoc.SelectSingleNode("//returnsms");//当节点Workflow带有属性是,使用SelectSingleNode无法读取 if (root != null) { string RetureState = (root.SelectSingleNode("returnstatus")).InnerText; string ErrorDescribe = (root.SelectSingleNode("message")).InnerText; string RetureBalance = root.SelectSingleNode("remainpoint").InnerText; string SequenceId = root.SelectSingleNode("taskID").InnerText; string SuccessCounts = root.SelectSingleNode("successCounts").InnerText; if (int.Parse(SuccessCounts) > 0)//发送成功添加记录到短信记录表 { Hashtable ht = new Hashtable(); ht["MessageType"] = 0; ht["Number"] = "DX" + System.DateTime.Now.ToString("yyMMddHHmmss") + Number; ht["Code"] = Number; // ht["ReceiveType"] = 3; //接收对象类型 ht["ReceiveObject"] = "个人(验证码)"; //接收对象 ht["SendNum"] = 1; //发送短信数量 ht["SendUser"] = "******"; ht["SendContent"] = content; //发送内容 ht["SendType"] = 0; //发送类型(0、即时 1、实时) ht["SendMoney"] = SendMoney; ht["DeductionType"] = 1; //扣费类型(0赠送扣除 1营销费扣除 2费用不足够抵扣) ht["SingleMoney"] = SendMoney; //单条短信费用 ht["MulTiple"] = 1; //短信倍数 ht["State"] = 1; //状态(1审核中、2部分成功、3发送失败、4发送成功) ht["RetureState"] = RetureState; ht["ErrorDescribe"] = ErrorDescribe; ht["RetureBalance"] = RetureBalance; ht["SequenceId"] = SequenceId; ht["SuccessCounts"] = SuccessCounts; ht["PhoneSubmit"] = Phone; ht["HotelName"] = HotelName; ht["AdminHotelid"] = AdminHotelid; bool IsOk = DataFactory.SqlDataBase().Submit_AddOrEdit("SendRecord", "ID", "", ht); return(true); } else {//失败记录 Hashtable ht = new Hashtable(); ht["MessageType"] = 0; ht["Number"] = "DX" + System.DateTime.Now.ToString("yyMMddHHmmss") + Number; ht["Code"] = Number; // ht["ReceiveType"] = 3; //接收对象类型 ht["ReceiveObject"] = "个人(验证码)"; //接收对象 ht["SendNum"] = 1; //发送短信数量 ht["SendUser"] = "******"; ht["SendContent"] = content; //发送内容 ht["SendType"] = 0; //发送类型(0、即时 1、实时) ht["SendMoney"] = SendMoney; ht["DeductionType"] = 1; //扣费类型(0赠送扣除 1营销费扣除 2费用不足够抵扣) ht["SingleMoney"] = SendMoney; //单条短信费用 ht["MulTiple"] = 1; //短信倍数 ht["State"] = 3; //状态(1审核中、2部分成功、3发送失败、4发送成功) ht["PhoneSubmit"] = Phone; ht["HotelName"] = HotelName; ht["AdminHotelid"] = AdminHotelid; bool IsOk = DataFactory.SqlDataBase().Submit_AddOrEdit("SendRecord", "ID", "", ht); return(false); } } else { Console.WriteLine("the node is not existed"); return(false); } } catch (Exception e) { //显示错误信息 Console.WriteLine(e.Message); return(false); } } else { // 解析 Result return(false); } }