public Nhs() { oplog = OperLog.instance; sb = new StringBuilder(); dbconf = OraConf.instance.DBs[0]; //file = nhsfile; }
private void LoadConf() { log.WriteFileLog("加载配置文件"); XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(conf); XmlElement root = xmldoc.DocumentElement; // 读取显示属性 XmlNode xn; try { xn = root.SelectSingleNode("encry_str"); keystr = xn.Attributes["key"].InnerText; } catch (Exception ex) { keystr = string.Empty; } // 读取Ssh连接配置 xn = root.SelectSingleNode("DBBase"); XmlNodeList xnl = xn.ChildNodes; XmlNodeList xll; foreach (XmlNode x in xnl) { // 跳过注释,否则格式不对,会报错 if (x.NodeType == XmlNodeType.Comment) { continue; } DBConf d = new DBConf(x.Attributes["dbtns"].InnerText, x.Attributes["note"].InnerText); xll = x.ChildNodes; foreach (XmlNode xx in xll) { DBUser u = new DBUser(xx.Attributes["name"].InnerText, xx.Attributes["pass"].InnerText, xx.Attributes["note"].InnerText); u.file = xx.Attributes["file"].InnerText; d.Users.Add(u); } DBs.Add(d); } log.WriteFileLog("配置初始化完成"); }
private void LoadConf() { log.WriteFileLog("加载配置文件"); XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(conf); XmlElement root = xmldoc.DocumentElement; // 读取显示属性 XmlNode xn; try { xn = root.SelectSingleNode("encry_str"); keystr = xn.Attributes["key"].InnerText; } catch (Exception ex) { keystr = string.Empty; } // 读取Ssh连接配置 xn = root.SelectSingleNode("DBBase"); XmlNodeList xnl = xn.ChildNodes; XmlNodeList xll; foreach (XmlNode x in xnl) { // 跳过注释,否则格式不对,会报错 if (x.NodeType == XmlNodeType.Comment) continue; DBConf d = new DBConf(x.Attributes["dbtns"].InnerText, x.Attributes["note"].InnerText); xll = x.ChildNodes; foreach (XmlNode xx in xll) { DBUser u = new DBUser(xx.Attributes["name"].InnerText, xx.Attributes["pass"].InnerText, xx.Attributes["note"].InnerText); u.file = xx.Attributes["file"].InnerText; d.Users.Add(u); } DBs.Add(d); } log.WriteFileLog("配置初始化完成"); }