SharpTuneCore.ECUMetaData.ReadEcuFlashScalings C# (CSharp) Method

ReadEcuFlashScalings() public method

public ReadEcuFlashScalings ( XDocument xmlDoc, IXmlLineInfo info ) : bool
xmlDoc XDocument
info IXmlLineInfo
return bool
        public bool ReadEcuFlashScalings(XDocument xmlDoc, IXmlLineInfo info)
        {
            var scalingQuery = from sc in xmlDoc.XPathSelectElements("/rom/scaling")
                                //where table.Ancestors("table").First().IsEmpty
                                select sc;
            foreach (XElement scaling in scalingQuery)
            {
                try{
                    info = (IXmlLineInfo)scaling;
                    //skip scalings with no name
                    if (scaling.Attribute("name") == null) throw new Exception("Error, scaling name is null!");
                    string scalingname = scaling.Attribute("name").Value.ToString();
                    if (!this.ScalingList.ContainsKey(scalingname))
                    {
                        this.ScalingList.Add(scalingname, ScalingFactory.CreateScaling(scaling));
                    }
                }
                catch (Exception crap)
                {
                    Trace.WriteLine("Error reading scaling in " + filePath + " Line number: " + info.LineNumber);
                    Trace.WriteLine(crap.Message);
                    throw;
                }
            }
            return true;
        }