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的更多相关文章

  1. Jekins 插件Extended Choice Parameter显示Json Parameter Type遇到的问题

    在jenkins中使用Extended Choice Parameter插件用来显示自定义的多选项,尝试通过groovy script来显示,正常,但查看它的例子,发现它例子中多选是通过类型 Json ...

  2. Oracle巡检脚本:ORAWatcher.sh

    Oracle巡检脚本:ORAWatcher.sh #!/usr/bin/ksh echo "" echo "ORAWatcher Version:1.0.1" ...

  3. phpredis中文手册——《redis中文手册》 php版

    本文是参考<redis中文手册>,将示例代码用php来实现,注意php-redis与redis_cli的区别(主要是返回值类型和参数用法). 目录(使用CTRL+F快速查找命令): Key ...

  4. ruby -- 进阶学习(六) devise修改邮件发送者邮箱

    在config/environment.rb/development.rb或者config/environment/production.rb中, 简单示范例子: Text03::Applicatio ...

  5. 《redis-php中文参考手册》

    <redis中文手册>,将示例代码用php来实现,注意php-redis与redis_cli的区别(主要是返回值类型和参数用法). phpredis是redis的php的一个扩展,效率是相 ...

  6. phpredis中文手册——《redis中文手册》 php版--引用他人

    出处: http://www.cnblogs.com/zcy_soft/archive/2012/09/21/2697006.html 目录(使用CTRL+F快速查找命令): Key String H ...

  7. Redis 命令 - Server

    BGREWRITEAOF Asynchronously rewrite the append-only file BGSAVE Asynchronously save the dataset to d ...

  8. Nginx - SSI Module

    SSI, for Server Side Includes, is actually a sort of server-side programming language interpreted by ...

  9. MVC WEB api 自动生成文档

    最近在一直在用webapi做接口给移动端用.但是让我纠结的时候每次新加接口或者改动接口的时候,就需要重新修改文档这让我很是苦恼.无意中发现.webapi居然有自动生成文档的功能....真是看见了救星啊 ...

随机推荐

  1. SQL Server-游标使用

    IF EXISTS(SELECT *FROM sysobjects WHERE name='sp_ContestSubmit') DROP PROC sp_ContestSubmit GO -- == ...

  2. Android酷炫实用的开源框架——UI框架(转)

    转载别人整理好的文章,列出了很多炫酷的UI开源设计 原文地址:http://www.androidchina.net/1992.html 1.Side-Menu.Android分类侧滑菜单,Yalan ...

  3. Sublime Text 3103 Crack 破解 注册码(亲测有效)

    随机复制下面的几四个注册码 粘贴到sublime text 3(Build 3103)注册框 就可以了! 第一个--first licence key : ====================== ...

  4. WCF 数据服务 4.5

    .NET Framework 4.5 其他版本 WCF 数据服务(以前称为"ADO.NET Data Services")是 .NET Framework 的一个组件.可以使用此组 ...

  5. 深入剖析 redis RDB 持久化策略

    简介 redis 持久化 RDB.AOF redis 提供两种持久化方式:RDB 和 AOF.redis 允许两者结合,也允许两者同时关闭. RDB 可以定时备份内存中的数据集.服务器启动的时候,可以 ...

  6. 图像拼接 SIFT资料合集

    转自 http://blog.csdn.net/stellar0/article/details/8741780 分类: 最近也注意一些图像拼接方面的文章,很多很多,尤其是全景图拼接的,实际上类似佳能 ...

  7. 几组User-Agent

    Your User Agent String is: Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.19 (KHTML, like Gecko) Ubun ...

  8. eclipse新建一个Android项目,就会报错android.support.v7.app.ActionBarActivity

    解决方法: 今天被这个问题折腾了一下,最后终于找到了解决办法. 产生这个问题,是因为你升级了ADT到version 22,但是还需要升级SDK Tools,Platform Tools,Build T ...

  9. Linux流量监控工具-iftop教程

    Linux流量监控工具-iftop教程http://automationqa.com/forum.php?mod=viewthread&tid=2854&fromuid=2

  10. RestTemplate 使用总结

    场景: 认证服务器需要有个 http client 把前端发来的请求转发到 backend service, 然后把 backend service 的结果再返回给前端,服务器本身只做认证功能. 遇到 ...