1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- //-----------------------------------------------------------------------
- // <copyright company="偶偶阅读网" file="ConfigureHelper.cs">
- // Copyright (c) V1.0
- // 作者:季健国
- // 功能:配置参数
- // 历史版本:2013-11-26 新增
- // </copyright>
- //-----------------------------------------------------------------------
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Web;
- using System.Xml;
- namespace Ant.Common
- {
- public class ConfigureHelper
- {
- private static string configpath = string.Empty;
- /// <summary>
- /// 账号配置信息文件路径
- /// </summary>
- private static string ConfigPath
- {
- get
- {
- if (string.IsNullOrEmpty(configpath))
- {
- if (GlobalFileHelper.IsInner())
- {
- configpath = HttpContext.Current.Server.MapPath(GlobalFileHelper.ApplicationPath + "/App_Data/OOConfig/OOReadConfigure_Test.config");
- }
- else
- {
- configpath = HttpContext.Current.Server.MapPath(GlobalFileHelper.ApplicationPath + "/App_Data/OOConfig/OOReadConfigure_Line.config");
- }
- }
- return configpath;
- }
- }
- /// <summary>
- /// xmlDoc
- /// </summary>
- private static XmlDocument xmlDoc = null;
- /// <summary>
- /// XmlDoc
- /// </summary>
- private static XmlDocument XmlDoc
- {
- get
- {
- if (xmlDoc == null)
- {
- xmlDoc = LoadXmlHelper.XmlLoading(ConfigPath);
- }
- return xmlDoc;
- }
- }
- /// <summary>
- /// 获取配置文件节点值
- /// </summary>
- /// <param name="AppKey">AppKey 是 key Name</param>
- /// <returns></returns>
- public static string GetConfigureValue(string AppKey)
- {
- string appValue = string.Empty;
- XmlNode xmlNode;
- XmlElement xmlEle;
- xmlNode = XmlDoc.SelectSingleNode("//appSettings");
- xmlEle = (XmlElement)xmlNode.SelectSingleNode("//add[@key='" + AppKey + "']");
- if (xmlEle != null)
- {
- appValue = xmlEle.GetAttribute("value");
- }
- return appValue;
- }
- }
- }
|