using System;
namespace CommonTool
{
public class GetConnStr
{
public GetConnStr()
{
//string connStr = AppEnv.ReadConnectionConfig();
//SnXmlNode conXmlNode = SnXmlNode.ParseGenericXml(connStr);
//ConnStr = conXmlNode.GetChildValue("ConnectionStr");
ConnStr = new GetRsdbNodeValue("ConnectionStr").ValueStr;
}
public string ConnStr { get; }
}
public class AppEnv
{
public static string ReadConnectionConfig()
{
return FileFuns.ReadEncryptedFile("RSDB.cfg", "qwertyuiopasdfgh");
}
public static string ConfigFile
{
get
{
//string text1 = LocalPath + "Config.rsc";
string text1 = "Config.rsc";
string text2 = FileFuns.GetFullPathFileName(text1);
if (text2 != "")
{
text1 = text2;
}
else
text1 = LocalPath + "Config.rsc";
return text1;
}
}
public static string LocalPath => AppDomain.CurrentDomain.BaseDirectory;
}
///
/// 获取配置文件RSDB中相应节点的str
///
public class GetRsdbNodeValue
{
///
/// 节点
///
public string XmlNodeStr { get; set; }
///
/// 节点值
///
public string ValueStr { get; }
///
/// 构造函数
///
/// 需要获取的节点
public GetRsdbNodeValue(string xmlNodeStr)
{
XmlNodeStr = xmlNodeStr;
ValueStr =
SnXmlNode.ParseGenericXml(FileFuns.ReadEncryptedFile("RSDB.cfg", "qwertyuiopasdfgh")).GetChildValue(XmlNodeStr);
}
}
}