Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 6141b84a authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

sort tire nodes by axle number in job xml

parent e91a148a
No related branches found
No related tags found
No related merge requests found
......@@ -168,8 +168,10 @@ namespace TUGraz.VectoHashing
throw new Exception(string.Format("index exceeds number of components found! index: {0}, #components: {1}", index,
nodes.Count));
}
var componentId = nodes[index].Attributes[XMLNames.Component_ID_Attr].Value;
return GetHashValueFromSig(DoComputeHash(nodes[index], canonicalization, digestMethod), componentId);
var sortedNodes = SortComponentNodes(component, nodes);
var componentId = sortedNodes[index].Attributes[XMLNames.Component_ID_Attr].Value ?? "";
return GetHashValueFromSig(DoComputeHash(sortedNodes[index], canonicalization, digestMethod), componentId);
}
private static XmlDocument DoComputeHash(XmlNode dataNode, IEnumerable<string> canonicalization, string digestMethod)
......@@ -381,7 +383,7 @@ namespace TUGraz.VectoHashing
return ReadHashValue(nodes[index]);
}
private XmlNodeList GetNodes(VectoComponents? component, int index)
private XmlNode[] GetNodes(VectoComponents? component, int index)
{
var nodes = Document.SelectNodes(GetComponentQueryString(component));
if (nodes == null || nodes.Count == 0) {
......@@ -393,7 +395,17 @@ namespace TUGraz.VectoHashing
throw new Exception(string.Format("index exceeds number of components found! index: {0}, #components: {1}", index,
nodes.Count));
}
return nodes;
return SortComponentNodes(component, nodes);
}
private XmlNode[] SortComponentNodes(VectoComponents? component, XmlNodeList nodes)
{
if (component != null && component == VectoComponents.Tyre) {
return nodes.Cast<XmlNode>()
.OrderBy(x => x.SelectSingleNode("./ancestor-or-self::*[@axleNumber]/@axleNumber")?.Value.ToInt() ?? 0).ToArray();
}
return nodes.Cast<XmlNode>().ToArray();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment