Parameter Config
public class ConfigInfo
{
public static ScriptsHelper Scripts
{
get { return new ScriptsHelper(); }
}
public static ParametersHelper Parameters
{
get { return new ParametersHelper(); }
}
} public class ScriptsHelper
{
string fileName = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, @"Configs\Scripts.xml");
public PerScript this[string name]
{
get
{
string value = Tools.ExecuteXPathInFile(fileName, string.Format(@"/Scripts/Script[@name='{0}']/text()", name.Trim()));
string connection = Tools.ExecuteXPathInFile(fileName, string.Format(@"/Scripts/Script[@name='{0}']/@connectionName", name.Trim()));
PerScript script = new PerScript(value, connection);
return script;
}
} public class PerScript
{
public PerScript(string value, string connection)
{
m_Value = value;
m_Connection = connection;
} string m_Value;
public string Value { get { return m_Value; } } string m_Connection;
public string Connection { get { return m_Connection; } }
}
} public class ParametersHelper
{
string fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, JobConstValue.SERVICE_PARAMETER_FILE);
public PerKeyValue this[string name]
{
get
{
string keyValueStr = Tools.ExecuteXPathInFile(fileName, string.Format(@"/KeyValues/KeyValue[@name='{0}']", name.Trim()));
if (keyValueStr != null)
{
PerKeyValue returnObj = new PerKeyValue(name, keyValueStr);
return returnObj;
}
else
{
return null;
}
}
} public class PerKeyValue
{
public PerKeyValue(string name, string keyValueStr)
{
m_KeyValueStr = keyValueStr;
m_Name = name;
m_Value = Tools.ExecuteXPathInString(keyValueStr, @"/KeyValue/text()");
} string m_KeyValueStr; private string m_Name;
public string Name { get { return m_Name; } } public PerKeyValueAttributes Attributes
{
get
{
string[] temp = m_KeyValueStr.GetSubString(@"(?<=\<KeyValue\s+).+.(?=/?\>)");
if (temp != null && temp.Length > )
return new PerKeyValueAttributes(temp[]);
else
return null;
}
} string m_Value;
public string Value { get { return m_Value; } } public List<PerKeyValue> KeyValus
{
get
{
List<PerKeyValue> list = null;
XmlDocument doc = new XmlDocument();
doc.LoadXml(m_KeyValueStr);
XmlNodeList nodes = doc.SelectNodes("/KeyValue/KeyValue");
if (nodes != null && nodes.Count > )
{
list = new List<PerKeyValue>();
foreach (XmlNode item in nodes)
{
list.Add(new PerKeyValue(item.Attributes["name"].InnerText, item.OuterXml));
}
}
return list;
}
} public PerKeyValue this[string name]
{
get
{
string keyValueStr = Tools.ExecuteXPathInString(m_KeyValueStr, string.Format(@"/KeyValue/KeyValue[@name='{0}']", name.Trim()));
if (keyValueStr != null)
return new PerKeyValue(name, keyValueStr);
else
return null;
}
}
} public class PerKeyValueAttributes
{
public PerKeyValueAttributes(string attributes)
{
m_Attributes = attributes;
} string m_Attributes = string.Empty; public string this[string name]
{
get
{
string[] results = m_Attributes.GetSubString(string.Format(@"(?<={0}\s*="").+", name));
if (results != null && results.Length > )
{
return results[].ReplaceString(@""".*", string.Empty);
}
else
return null;
}
}
}
}
Parameter Config的更多相关文章
- Jekins 插件Extended Choice Parameter显示Json Parameter Type遇到的问题
在jenkins中使用Extended Choice Parameter插件用来显示自定义的多选项,尝试通过groovy script来显示,正常,但查看它的例子,发现它例子中多选是通过类型 Json ...
- Oracle巡检脚本:ORAWatcher.sh
Oracle巡检脚本:ORAWatcher.sh #!/usr/bin/ksh echo "" echo "ORAWatcher Version:1.0.1" ...
- phpredis中文手册——《redis中文手册》 php版
本文是参考<redis中文手册>,将示例代码用php来实现,注意php-redis与redis_cli的区别(主要是返回值类型和参数用法). 目录(使用CTRL+F快速查找命令): Key ...
- ruby -- 进阶学习(六) devise修改邮件发送者邮箱
在config/environment.rb/development.rb或者config/environment/production.rb中, 简单示范例子: Text03::Applicatio ...
- 《redis-php中文参考手册》
<redis中文手册>,将示例代码用php来实现,注意php-redis与redis_cli的区别(主要是返回值类型和参数用法). phpredis是redis的php的一个扩展,效率是相 ...
- phpredis中文手册——《redis中文手册》 php版--引用他人
出处: http://www.cnblogs.com/zcy_soft/archive/2012/09/21/2697006.html 目录(使用CTRL+F快速查找命令): Key String H ...
- Redis 命令 - Server
BGREWRITEAOF Asynchronously rewrite the append-only file BGSAVE Asynchronously save the dataset to d ...
- Nginx - SSI Module
SSI, for Server Side Includes, is actually a sort of server-side programming language interpreted by ...
- MVC WEB api 自动生成文档
最近在一直在用webapi做接口给移动端用.但是让我纠结的时候每次新加接口或者改动接口的时候,就需要重新修改文档这让我很是苦恼.无意中发现.webapi居然有自动生成文档的功能....真是看见了救星啊 ...
随机推荐
- SMON功能(一):清理临时段
温故而知新 SMON功能(一) SMON(system monitor process)系统监控后台进程,有时候也被叫做system cleanup process,这么叫的原因是它负责完成很多清理( ...
- Win7版IE10浏览器正式版官方下载地址
• 简体中文,Win7 SP1 32位版IE10下载: http://download.microsoft.com/download/4/1/4/4149BFB1-AC27-401D-943F-DA1 ...
- Hibernate不调用update却自动更新
案例: TInfCustomer cus = (TInfCustomer) this.baseDao.getOne(helper); cus.setXXX cus .setXXX 不调用update也 ...
- 美行Thinkpad八通道快捷入口
美行Thinkpad八通道快捷入口 链接: http://shop.lenovo.com/perksoffer/us/en/laptops/thinkpad/?__followRobots=true打 ...
- c++ bind1st 和 bind2nd的用法
std::bind1st 和 std::bind2nd将二元函数转换为一元函数,具体用法参加下面的代码. 代码介绍了两种使用方式,第一种是使用std::less和std::greater,第二种是使用 ...
- 解决tkinter在windows上没有正确安装的问题
问题 Can't find a usable tk.tcl in the following directories: 解决方法 加两个环境变量,在我的机器上是这样的 TCL_LIBRARY=D:\d ...
- Visual Studio 2010配置Opencv2.4.9
转自: http://blog.csdn.net/huang9012/article/details/21811129 这篇文章作为OpenCV的启程篇,自然少不了先系统地介绍OpenCV开发环境的配 ...
- spring mvc jsp运行不起来的问题
spring mvc已经处理成让jsp运行,即: <bean class="org.springframework.web.servlet.view.InternalResourceV ...
- struts2:struts.xml配置文件详解
1. 几个重要的元素 1.1 package元素 package元素用来配置包.在Struts2框架中,包是一个独立的单位,通过name属性来唯一标识包.还可以通过extends属性让一个包继承另一个 ...
- 测试卡尔曼滤波器(Kalman Filter)
真实的温度测试数据,通过加热棒加热一盆水测得的真实数据,X轴是时间秒,Y轴是温度: 1)滤波前 2)滤波后(p=10, q=0.0001, r=0.05, kGain=0;) 2)滤波后(p=10, ...