public XmlQuery ( string nodePath, string xmlPath ) : |
||
nodePath | string | 节点路径 |
xmlPath | string | 读取的xml文件的路径 |
return |
/// <summary> /// 执行检出操作 /// </summary> /// <param name="repositoryPath">svn服务器路径</param> /// <param name="workDirectory">工程本地工作路径</param> /// <param name="svnPath">本地svn路径</param> /// <param name="checkResult">检出操作的结果</param> /// <returns>返回检出操作的日志</returns> public string CheckOut(string repositoryPath,string workDirectory,out string checkResult,string xmlConfigPath) { string err; string time; XmlDao xmlDao = new XmlDao(); XmlNodeList xmlNodeList=xmlDao.XmlQuery("config/preferences/SvnPath", xmlConfigPath); string svnPath=xmlNodeList[0].InnerText; using (SvnClient client = new SvnClient()) { Tools tools = new Tools(); string checkOutLog = ""; try { client.CheckOut(new Uri(repositoryPath), workDirectory); string args = "checkout " + repositoryPath + " " + workDirectory; checkOutLog = tools.BuildProject(svnPath, args, null, out err, out time); checkResult = "successful"; return checkOutLog; } catch (Exception ex) { checkResult = " failed"; checkOutLog = ex.Message; return checkOutLog; } } }
/// <summary> /// 查询配置信息 /// </summary> /// <param name="dataPath">节点路径</param> /// <param name="xmlConfigPath">查询的xml文件路径</param> /// <returns></returns> public ConfigInfo ConfigQuery(string dataPath,string xmlConfigPath) { ConfigInfo configInfo = new ConfigInfo(); XmlDao xmlDao = new XmlDao(); try { XmlNodeList xmlNodeList = xmlDao.XmlQuery(dataPath, xmlConfigPath); configInfo.Svnpath = xmlNodeList[0].SelectSingleNode("SvnPath").InnerText; configInfo.Updateinterval = xmlNodeList[0].SelectSingleNode("UpdateInterval").InnerText; configInfo.StandarOutput = xmlNodeList[0].SelectSingleNode("StandarOutput").InnerText; configInfo.ServiceSwitch = xmlNodeList[0].SelectSingleNode("ServiceSwitch").InnerText; return configInfo; } catch (Exception) { return configInfo; } }
/// <summary> /// 获取gitlab信息 /// </summary> /// <param name="dataPath">节点路径</param> /// <param name="xmlConfigPath">xml路径</param> /// <returns></returns> public GitInfo GitInfoQuery(string dataPath, string xmlConfigPath) { GitInfo gitlabInfo = new GitInfo(); XmlDao xmlDao = new XmlDao(); try { XmlNodeList xmlNodeList = xmlDao.XmlQuery(dataPath, xmlConfigPath); gitlabInfo.Username = xmlNodeList[0].SelectSingleNode("Username").InnerText; gitlabInfo.Password = xmlNodeList[0].SelectSingleNode("Password").InnerText; gitlabInfo.Emailaddress = xmlNodeList[0].SelectSingleNode("Email").InnerText; gitlabInfo.Gitreversion = xmlNodeList[0].SelectSingleNode("GitReversion").InnerText; return gitlabInfo; } catch (Exception) { return gitlabInfo; } }
/// <summary> /// 执行获取所有符合要求的项目信息列表 /// </summary> /// <param name="dataPath">查询的节点路径</param> /// <param name="b">true:项目信息;false:最近一次编译信息</param> /// <returns>返回查寻完毕的信息列表</returns> public List<ProjectInfo> ProjectQuery(string dataPath,bool b,string xmlPath) { List<ProjectInfo> projectInfos = new List<ProjectInfo>(); XmlDao xmlDao = new XmlDao(); if (b) { try { XmlNodeList xmlNodeList = xmlDao.XmlQuery(dataPath,xmlPath); foreach (XmlNode xmlNode in xmlNodeList) { ProjectInfo projectInfo = new ProjectInfo(); projectInfo.Statusproperty = xmlNode.Attributes["Status"].Value; projectInfo.Nameproperty = xmlNode.Attributes["Name"].Value; projectInfo.Buildcommand = xmlNode.SelectSingleNode("BuildCommand").InnerText; projectInfo.Repositorypath = xmlNode.SelectSingleNode("RepositoryPath").InnerText; projectInfo.Workdirectory = xmlNode.SelectSingleNode("WorkingDirectory").InnerText; projectInfo.MailTo = xmlNode.SelectSingleNode("MailTo").InnerText; projectInfo.IfMail = xmlNode.SelectSingleNode("IfMail").InnerText; projectInfo.IfSlack = xmlNode.SelectSingleNode("IfSlack").InnerText; projectInfo.SlackUrl = xmlNode.SelectSingleNode("SlackUrl").InnerText; projectInfo.MailHost = xmlNode.SelectSingleNode("MailHost").InnerText; projectInfo.UserName = xmlNode.SelectSingleNode("UserName").InnerText; projectInfo.Password = xmlNode.SelectSingleNode("Password").InnerText; projectInfo.SlackChannel = xmlNode.SelectSingleNode("SlackChannel").InnerText; projectInfo.SlackUser = xmlNode.SelectSingleNode("SlackUser").InnerText; projectInfo.SlackContent = xmlNode.SelectSingleNode("SlackContent").InnerText; projectInfos.Add(projectInfo); } return projectInfos; } catch (Exception) { return projectInfos; } } else { ProjectInfo projectInfo = new ProjectInfo(); XmlNodeList xmlNodeList = xmlDao.XmlQuery(dataPath, xmlPath); projectInfo.Nameproperty = xmlNodeList[0].SelectSingleNode("projectName").InnerText; projectInfo.BuildTime = xmlNodeList[0].SelectSingleNode("buildTime").InnerText; projectInfo.Duration = xmlNodeList[0].SelectSingleNode("duration").InnerText; projectInfo.Result = xmlNodeList[0].SelectSingleNode("result").InnerText; projectInfo.Index = xmlNodeList[0].SelectSingleNode("index").InnerText; projectInfos.Add(projectInfo); return projectInfos; } }
/// <summary> /// 查询配置信息 /// </summary> /// <param name="nodePath"></param> /// <returns></returns> public XmlNodeList FindConfigInfo(string nodePath,string xmlConfigPath) { XmlDao dao = new XmlDao(); return dao.XmlQuery(nodePath, xmlConfigPath); }
/// <summary> /// 获取人名对应表 /// </summary> /// <param name="nodePath">人名对应表节点路径</param> /// <param name="xmlPath">存放对应表的xml文件路径</param> /// <returns></returns> public XmlNodeList AcquireSlackPeople(string nodePath, string xmlPath) { XmlDao dao = new XmlDao(); return dao.XmlQuery(nodePath, xmlPath); }
/// <summary> /// 执行更新操作 /// </summary> /// <param name="workDirectory">工程本地工作路径</param> /// <param name="svnPath">svn程序的路径</param> /// <param name="updateResult">更新操作的结果</param> /// <returns>返回更新操作的日志</returns> public string Update(string workDirectory,out string updateResult,string xmlConfigPath) { string err; string time; Tools tools = new Tools(); XmlDao xmlDao = new XmlDao(); XmlNodeList xmlNodeList = xmlDao.XmlQuery("config/preferences/SvnPath", xmlConfigPath); string svnPath = xmlNodeList[0].InnerText; string updateLog = ""; try { string args = "update --accept tf" + " " + workDirectory; updateLog = tools.BuildProject(svnPath, args, null, out err, out time); updateResult = "successful"; return updateLog; } catch (Exception ex) { updateResult = "failed"; updateLog = ex.Message; return updateLog; } }