我在Jenkins主服务器上运行以下脚本
def workspace = pwd()
def sourceDir = new File(workspace)
println "Files: Traverse"
sourceDir.traverse(type: FileType.FILES, nameFilter: ~/.*\.cpp/) {
println it.path
}
Run Code Online (Sandbox Code Playgroud)
这仅返回一个文件:
[Pipeline] pwd
[Pipeline] echo
Files: Traverse
[Pipeline] echo
/var/lib/jenkins/workspace/job/project/Source/A/a.cpp
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Run Code Online (Sandbox Code Playgroud)
我已确认工作区包含所需的所有文件,我正在使用Jenkins v1.651.2
我的字符串包含字节(例如0x27),基本上我需要做的是将包含字节数据的字符串数组转换为byte数据类型,然后我可以对其进行编码UTF8,因此它显示有意义的信息.
1个字符串数组包含:
0x37,0x32,0x2d,0x38,0x33,0x39,0x37,0x32,0x2d,0x30,0x31
我需要转换为字节数组,这可能吗?
我的代码是:
string strData;
string strRaw;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.InnerXml = Data;
XmlElement xmlDocElement = xmlDoc.DocumentElement;
strData = xmlDocElement.GetAttribute("datalabel").ToString();
strRaw = xmlDocElement.GetAttribute("rawdata").ToString();
string[] arrData = strData.Split(' ');
string[] arrRaw = strRaw.Split(' ');
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助.