Beispiel #1
0
        public bool ReadEcuFlashRamTables(XDocument xmlDoc, IXmlLineInfo info)
        {
            // RAM table feteches here!
            var ramtableQuery = from t in xmlDoc.XPathSelectElements("/ram/table")
                                select t;

            foreach (XElement table in ramtableQuery)
            {
                try
                {
                    info = table;
                    if (table.Attribute("name") == null)
                    {
                        continue;
                    }
                    string tablename = table.Attribute("name").Value.ToString();

                    AddRamTable(TableFactory.CreateTable(table, tablename, this), info.LineNumber);
                }
                catch (Exception crap)
                {
                    Trace.WriteLine("Error reading RAM tables in " + filePath + " Line number: " + info.LineNumber);
                    Trace.WriteLine(crap.Message);
                    throw;
                }
            }
            return(true);
        }
Beispiel #2
0
        public override TableMetaData CreateChild(LookupTable ilut, ECUMetaData d)
        {
            //TODO: This is a major KLUDGE.
            if (ilut.GetType() != typeof(LookupTable2D))
            {
                return(base.CreateChild(ilut, d));
            }

            XElement      xel;
            LookupTable2D lut = (LookupTable2D)ilut;

            xel = new XElement("table");
            xel.SetAttributeValue("name", name);
            xel.SetAttributeValue("address", ilut.dataAddress.ToString("X"));
            if (this.xAxis != null)
            {
                XElement tx = new XElement("table");
                tx.SetAttributeValue("name", "X");
                tx.SetAttributeValue("address", lut.colsAddress.ToString("X"));
                tx.SetAttributeValue("elements", lut.cols);
                xel.Add(tx);
            }
            else
            {
                XElement ty = new XElement("table");
                ty.SetAttributeValue("name", "Y");
                ty.SetAttributeValue("address", lut.colsAddress.ToString("X"));
                ty.SetAttributeValue("elements", lut.cols);
                xel.Add(ty);
            }
            return(TableFactory.CreateTable(xel, name, d));
            //TODO also set attirbutes and split this up! Copy to table2D!!
            //return base.CreateChild(lut,d);
            //TODO FIX?? AND CHECK FOR STATIC AXES!!
        }
Beispiel #3
0
        public virtual Table CreateChild(Lut lut, Definition d)
        {
            XElement xml = new XElement("table");

            xml.SetAttributeValue("name", name);
            xml.SetAttributeValue("address", lut.dataAddress.ToString("X"));
            return(TableFactory.CreateTable(xml, d));
            //TODO also set attirbutes and split this up!
        }
Beispiel #4
0
        public virtual TableMetaData CreateChild(LookupTable lut, ECUMetaData d)
        {
            XElement xel = new XElement("table");

            xel.SetAttributeValue("name", name);
            xel.SetAttributeValue("address", lut.dataAddress.ToString("X"));
            return(TableFactory.CreateTable(xel, name, d));
            //TODO also set attirbutes and split this up!
        }
Beispiel #5
0
        /// <summary>
        /// Load parameters from XML an XML file
        /// </summary>
        public bool ReadXML(string path)
        {
            if (path == null)
            {
                return(false);
            }
            XDocument xmlDoc = XDocument.Load(path, LoadOptions.PreserveWhitespace);
            // ROM table fetches here!
            var tableQuery = from t in xmlDoc.XPathSelectElements("/rom/table")
                             select t;

            foreach (XElement table in tableQuery)
            {
                if (table.Attribute("name") == null)
                {
                    continue;
                }
                string tablename = table.Attribute("name").Value.ToString();
                AddRomTable(TableFactory.CreateTable(table, this));
            }
            // RAM table feteches here!
            var ramtableQuery = from t in xmlDoc.XPathSelectElements("/ram/table")
                                select t;

            foreach (XElement table in ramtableQuery)
            {
                if (table.Attribute("name") == null)
                {
                    continue;
                }
                string tablename = table.Attribute("name").Value.ToString();

                AddRamTable(TableFactory.CreateTable(table, this));
            }
            //Read Scalings
            var scalingQuery = from sc in xmlDoc.XPathSelectElements("/rom/scaling")
                               //where table.Ancestors("table").First().IsEmpty
                               select sc;

            foreach (XElement scaling in scalingQuery)
            {
                //skip scalings with no name
                if (scaling.Attribute("name") == null)
                {
                    continue;
                }
                string scalingname = scaling.Attribute("name").Value.ToString();
                if (!this.ScalingList.ContainsKey(scalingname))
                {
                    this.ScalingList.Add(scalingname, ScalingFactory.CreateScaling(scaling));
                }
            }
            return(true);
        }
Beispiel #6
0
        public override Table CreateChild(Lut ilut, Definition d)
        {
            Lut3D lut = (Lut3D)ilut;

            xml = new XElement("table");
            xml.SetAttributeValue("name", name);
            xml.SetAttributeValue("address", ilut.dataAddress.ToString("X"));
            XElement tx = new XElement("table");

            tx.SetAttributeValue("name", "X");
            tx.SetAttributeValue("address", lut.colsAddress.ToString("X"));
            tx.SetAttributeValue("elements", lut.cols);
            xml.Add(tx);
            XElement ty = new XElement("table");

            ty.SetAttributeValue("name", "Y");
            ty.SetAttributeValue("address", lut.rowsAddress.ToString("X"));
            ty.SetAttributeValue("elements", lut.rows);
            xml.Add(ty);
            return(TableFactory.CreateTable(xml, d));
            //TODO also set attirbutes and split this up! Copy to table2D!!
        }
Beispiel #7
0
        public override TableMetaData CreateChild(LookupTable ilut, ECUMetaData d)
        {
            XElement      xel;
            LookupTable3D lut = (LookupTable3D)ilut;

            xel = new XElement("table");
            xel.SetAttributeValue("name", name);
            xel.SetAttributeValue("address", ilut.dataAddress.ToString("X"));
            XElement tx = new XElement("table");

            tx.SetAttributeValue("name", "X");
            tx.SetAttributeValue("address", lut.colsAddress.ToString("X"));
            tx.SetAttributeValue("elements", lut.cols);
            xel.Add(tx);
            XElement ty = new XElement("table");

            ty.SetAttributeValue("name", "Y");
            ty.SetAttributeValue("address", lut.rowsAddress.ToString("X"));
            ty.SetAttributeValue("elements", lut.rows);
            xel.Add(ty);
            return(TableFactory.CreateTable(xel, name, d));
            //TODO also set attirbutes and split this up! Copy to table2D!!
        }