From b78a7854ad045dc190423c436c610d4371372ded Mon Sep 17 00:00:00 2001 From: Adam M Rivera Date: Wed, 25 Apr 2012 13:39:03 -0500 Subject: [PATCH] Planner: Implemented the ParameterMetaDataRepository.cs's GetParameterMetaData method. It will now return a meta value by the parameter name and meta key. --- .../Utilities/ParameterMetaDataRepository.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Tools/ArdupilotMegaPlanner/Utilities/ParameterMetaDataRepository.cs b/Tools/ArdupilotMegaPlanner/Utilities/ParameterMetaDataRepository.cs index 0697a76c07..738e684880 100644 --- a/Tools/ArdupilotMegaPlanner/Utilities/ParameterMetaDataRepository.cs +++ b/Tools/ArdupilotMegaPlanner/Utilities/ParameterMetaDataRepository.cs @@ -3,6 +3,7 @@ using System.Configuration; using System.IO; using System.Windows.Forms; using System.Xml.Linq; +using System.Linq; namespace ArdupilotMega.Utilities { @@ -32,7 +33,19 @@ namespace ArdupilotMega.Utilities { // Use this to find the endpoint node we are looking for // Either it will be pulled from a file in the ArduPlane hierarchy or the ArduCopter hierarchy - string endpointSearchString = (MainV2.cs.firmware == MainV2.Firmwares.ArduPlane) ? "arduplane" : "arducopter"; + var element = _parameterMetaDataXML.Element(MainV2.cs.firmware.ToString()); + if(element != null && element.HasElements) + { + var node = element.Element(nodeKey); + if(node != null && node.HasElements) + { + var metaValue = node.Element(metaKey); + if(metaValue != null) + { + return metaValue.Value; + } + } + } } return string.Empty; }