diff --git a/SourceCode/GPS/Forms/Field/FormFieldISOXML.cs b/SourceCode/GPS/Forms/Field/FormFieldISOXML.cs index 89d837b49..1030aed71 100644 --- a/SourceCode/GPS/Forms/Field/FormFieldISOXML.cs +++ b/SourceCode/GPS/Forms/Field/FormFieldISOXML.cs @@ -119,7 +119,7 @@ private void FormFieldISOXML_Load(object sender, EventArgs e) //First kind of Gudance GGP\GPN\LSG\PNT foreach (XmlNode nodePart in fieldParts) { - if (nodePart.Name == "GGP") + if (nodePart.Name == "GGP" && nodePart.ChildNodes[0].Attributes.GetNamedItem("B") != null && nodePart.ChildNodes[0].Attributes.GetNamedItem("C") != null) { //in GPN "B" is the name and "C" is the type if (nodePart.ChildNodes[0].Attributes["C"].Value == "1") @@ -139,12 +139,13 @@ private void FormFieldISOXML_Load(object sender, EventArgs e) foreach (XmlNode nodePart in fieldParts) { //LSG with a "5" in [A] means Guidance line [B] is the name of line - if (nodePart.Name == "LSG" && nodePart.Attributes["A"].Value == "5") + if (nodePart.Name == "LSG" && nodePart.ChildNodes[0].Attributes.GetNamedItem("A") != null && nodePart.Attributes["A"].Value == "5") { - if (nodePart.ChildNodes.Count < 3) - tree.Nodes[tree.Nodes.Count - 1].Nodes.Add("ABLine: " + nodePart.Attributes["B"].Value); - else - tree.Nodes[tree.Nodes.Count - 1].Nodes.Add("Curve: " + nodePart.Attributes["B"].Value); + if (nodePart.ChildNodes[0].Attributes.GetNamedItem("B") != null) + if (nodePart.ChildNodes.Count < 3) + tree.Nodes[tree.Nodes.Count - 1].Nodes.Add("ABLine: " + nodePart.Attributes["B"].Value); + else + tree.Nodes[tree.Nodes.Count - 1].Nodes.Add("Curve: " + nodePart.Attributes["B"].Value); } } } @@ -538,7 +539,10 @@ private void btnBuildFields_Click(object sender, EventArgs e) if (nodePart.ChildNodes[0].ChildNodes[0].Attributes["A"].Value == "5") //Guidance Pattern { //get the name + if (nodePart.ChildNodes[0].Attributes.GetNamedItem("B") != null) mf.ABLine.desName = nodePart.ChildNodes[0].Attributes["B"].Value; + else if(nodePart.ChildNodes[0].Attributes.GetNamedItem("A") != null) + mf.ABLine.desName = nodePart.Attributes["B"].Value; // fallback, if ChildNodes[0].Attributes["B"] is null double.TryParse(nodePart.ChildNodes[0].ChildNodes[0].ChildNodes[0].Attributes["C"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out latK); double.TryParse(nodePart.ChildNodes[0].ChildNodes[0].ChildNodes[0].Attributes["D"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out lonK); @@ -587,7 +591,10 @@ private void btnBuildFields_Click(object sender, EventArgs e) if (nodePart.ChildNodes[0].ChildNodes[0].Attributes["A"].Value == "5") //Guidance Pattern { //get the name - mf.curve.desName = nodePart.ChildNodes[0].Attributes["B"].Value; + if (nodePart.ChildNodes[0].Attributes.GetNamedItem("B") != null) + mf.curve.desName = nodePart.ChildNodes[0].Attributes["B"].Value; + else if (nodePart.ChildNodes[0].Attributes.GetNamedItem("A") != null) + mf.curve.desName = nodePart.Attributes["B"].Value; // fallback, if ChildNodes[0].Attributes["B"] is null double.TryParse(nodePart.ChildNodes[0].ChildNodes[0].ChildNodes[0].Attributes["C"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out latK); double.TryParse(nodePart.ChildNodes[0].ChildNodes[0].ChildNodes[0].Attributes["D"].Value, NumberStyles.Float, CultureInfo.InvariantCulture, out lonK);