//-----------------------------------------------------------------------
//
// Copyright (c) V1.0
// 作者:季健国
// 功能:配置参数
// 历史版本:2013-11-26 新增
//
//-----------------------------------------------------------------------
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;
///
/// 账号配置信息文件路径
///
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;
}
}
///
/// xmlDoc
///
private static XmlDocument xmlDoc = null;
///
/// XmlDoc
///
private static XmlDocument XmlDoc
{
get
{
if (xmlDoc == null)
{
xmlDoc = LoadXmlHelper.XmlLoading(ConfigPath);
}
return xmlDoc;
}
}
///
/// 获取配置文件节点值
///
/// AppKey 是 key Name
///
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;
}
}
}