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居然有自动生成文档的功能....真是看见了救星啊 ...
随机推荐
- 忘记hmailiserver邮件服务器后台登陆密码解决
进入后台进行hmailiserver的相关设置,发现登陆密码忘记了,如下图:
- c/c++ 输入输出缓冲区
关于缓冲区的详细介绍,请参考 C++编程对缓冲区的理解 CPP的输入输出流和缓冲区 c++输出缓冲区刷新 (1)c++中cin.cout,cerr和c的stdin.stdout.stderr都是同 ...
- Crypto++入门学习笔记(DES、AES、RSA、SHA-256)(加解密)
转自http://www.cppblog.com/ArthasLee/archive/2010/12/01/135186.html 最近,基于某些原因和需要,笔者需要去了解一下Crypto++库,然后 ...
- 完全图解scrollLeft,scrollWidth,clientWidth,offsetWidth 获取相对途径,滚动图片(网上找的,未经试验,但觉得比较好)
获取元素的位置属性可以通过 HTMLElement.offsetLeft HTMLElement.offsetTop 但是,这两个属性所储存的数值并不是该元素相对整个浏览器画布的绝对位置,而是相对于其 ...
- Why GUID primary keys are a database’s worst nightmare
http://csharptest.net/1250/why-guid-primary-keys-are-a-databases-worst-nightmare/ When you ask most ...
- dapper 操作类封装
using System; using System.Collections.Generic; using System.Data; using System.Data.SQLite; using S ...
- 我常用的Mac快捷键
1. 最小化当前窗口 command m 2. 在不同应用间切换 command tab 3. 在同一应用的不同窗口间切换 command ` 4. 在浏览器同一窗口的不同标签间切换 ctrl tab ...
- 前端经常使用插件使用文档 以及demo
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/ ...
- windows原生开发之界面疑云
windows桌面开发,界面始终是最大的困惑.我们对前端工具的要求,其实只有窗体设计器.消息映射,过分点的话自适应屏幕.模型绑定.能够免于手工书写,其实这个问题并不复杂,但VS不实现.QT语法 ...
- js实现表单序列化的两种方法。
function serialize(form) { var parts = [], elems = form.elements, i = , len = elems.length, filed = ...