예제 #1
0
        private void addToMyMapsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (gridViewSymbols.FocusedRowHandle >= 0)
            {
                SymbolHelper sh = (SymbolHelper)gridViewSymbols.GetRow(gridViewSymbols.FocusedRowHandle);
                SymbolCollection scmymaps = new SymbolCollection();
                SymbolHelper shnewmymap = new SymbolHelper();
                shnewmymap.Varname = sh.Varname;
                shnewmymap.Description = sh.Varname;
                shnewmymap.Category = "Directly added";
                scmymaps.Add(shnewmymap);
                string filename = System.Windows.Forms.Application.StartupPath + "\\mymaps.xml";
                if (File.Exists(filename))
                {
                    try
                    {
                        System.Xml.XmlDocument mymaps = new System.Xml.XmlDocument();
                        mymaps.Load(System.Windows.Forms.Application.StartupPath + "\\mymaps.xml");
                        foreach (System.Xml.XmlNode category in mymaps.SelectNodes("categories/category"))
                        {
                            foreach (System.Xml.XmlNode map in category.SelectNodes("map"))
                            {
                                SymbolHelper shmap = new SymbolHelper();
                                shmap.Varname = map.Attributes["symbol"].Value;
                                shmap.Category = category.Attributes["title"].Value;
                                shmap.Description = map.Attributes["title"].Value;
                                scmymaps.Add(shmap);
                            }
                        }
                    }
                    catch { }
                }
                // now save a new file
                if (File.Exists(filename))
                {
                    File.Delete(filename);
                }
                XmlDocument doc = new XmlDocument();// Create the XML Declaration, and append it to XML document
                XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", null, null);
                doc.AppendChild(dec);// Create the root element
                XmlElement root = doc.CreateElement("categories");
                doc.AppendChild(root);

                scmymaps.SortColumn = "Category";
                scmymaps.SortingOrder = GenericComparer.SortOrder.Ascending;
                scmymaps.Sort();

                string previouscat = "";
                XmlElement title = doc.CreateElement("category");
                foreach (SymbolHelper shmm in scmymaps)
                {
                    if (shmm.Category != previouscat)
                    {
                        previouscat = shmm.Category;
                        title = doc.CreateElement("category");
                        title.SetAttribute("title", previouscat);
                        root.AppendChild(title);
                    }
                    XmlElement map = doc.CreateElement("map");
                    map.SetAttribute("symbol", shmm.Varname);
                    map.SetAttribute("title", shmm.Description);
                    title.AppendChild(map);
                }
                doc.Save(filename);
                if (ribbonControl1.Pages[3].Text == "My Maps")
                {
                    ribbonControl1.Pages.RemoveAt(3);
                }
                LoadMyMaps();
            }
        }
예제 #2
0
        private void Actions_ExtractSymboltable_ItemClick(object sender, ItemClickEventArgs e)
        {
            m_symbols = new SymbolCollection();

            TryToOpenFileUsingClass(m_currentfile, out m_symbols, m_currentfile_size, true);
            barProgress.EditValue = 70;
            barProgress.Caption = "Sorting data";
            System.Windows.Forms.Application.DoEvents();

            m_symbols.SortColumn = "Length";
            m_symbols.SortingOrder = GenericComparer.SortOrder.Descending;
            m_symbols.Sort();
            barProgress.EditValue = 70;
            barProgress.Caption = "Loading data into view";
            System.Windows.Forms.Application.DoEvents();

            gridControlSymbols.DataSource = m_symbols;
            barProgress.EditValue = 0;
            barProgress.Caption = "Done";
            barProgress.Visibility = BarItemVisibility.Never;
            System.Windows.Forms.Application.DoEvents();
        }
예제 #3
0
        private void TransferMapsToNewBinary(string filename)
        {
            SymbolCollection curSymbolCollection = new SymbolCollection();
            //AddressLookupCollection curAddressLookupCollection = new AddressLookupCollection();
            resumeTuning = new System.Data.DataTable();
            resumeTuning.Columns.Add("Description");

            if (filename != string.Empty)
            {
                frmTransferSelectionSymbolsSelection frmtransfer = new frmTransferSelectionSymbolsSelection();
                SymbolCollection _onlyFlashSymbols = new SymbolCollection();
                foreach (SymbolHelper shcopy in m_symbols)
                {
                    if (shcopy.Flash_start_address > 0 && GetSymbolAddress(m_symbols, shcopy.Varname) < 524288 && shcopy.Length > 0 && ShouldTransferSymbol(shcopy))
                    {
                        _onlyFlashSymbols.Symbols.Add(shcopy);
                    }
                }
                frmtransfer.Symbols = /*m_symbols*/_onlyFlashSymbols;
                if (frmtransfer.ShowDialog() == DialogResult.OK)
                {
                    barProgress.Visibility = BarItemVisibility.Always;
                    barProgress.Caption = "Initializing";
                    barProgress.EditValue = 0;
                    System.Windows.Forms.Application.DoEvents();
                    File.Copy(filename, Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename) + DateTime.Now.ToString("yyyyMMddHHmmss") + "beforetransferringmaps.bin", true);
                    AddToResumeTable("Backup file created (" + Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename) + DateTime.Now.ToString("yyyyMMddHHmmss") + "beforetransferringmaps.bin)");
                    AddToResumeTable("Transferring data from " + Path.GetFileName(m_currentfile) + " to " + filename);
                    //bool m_fileparsed = false;

                    //listView1.Items.Clear();
                    SetStatusText("Start symbol parsing");

                    FileInfo fi = new FileInfo(filename);
                    Trionic7File transferToFile = TryToOpenFileUsingClass(filename, out curSymbolCollection, (int)fi.Length, false);
                    T7FileHeader t7fh = new T7FileHeader();
                    t7fh.init(filename, false);
                    int m_sramOffset = ReverseInt(t7fh.Unknown_9cvalue);
                    if (m_sramOffset == 0) m_sramOffset = transferToFile.SramOffsetForOpenFile;
                    if (m_sramOffset == 0) m_sramOffset = 0xEFFC04;
                    curSymbolCollection.SortColumn = "Flash_start_address";
                    curSymbolCollection.SortingOrder = GenericComparer.SortOrder.Ascending;
                    curSymbolCollection.Sort();
                    //progress.SetProgress("Start transfer");
                    barProgress.Caption = "Start transferring";
                    barProgress.EditValue = 1;
                    System.Windows.Forms.Application.DoEvents();

                    Int64 currentFlashAddress = 0;
                    foreach (SymbolHelper sh in curSymbolCollection)
                    {
                        currentFlashAddress = sh.Flash_start_address;
                        //TODO: Keep open bins in mind which have sram addresses in stead of normal addresses
                        if (IsSoftwareOpen(curSymbolCollection))
                        {
                            // get address
                            if (IsSymbolCalibration(sh.Varname) && sh.Length < 0x400 && sh.Flash_start_address > m_currentfile_size)
                            {
                                currentFlashAddress = sh.Flash_start_address - m_sramOffset;
                            }
                        }

                        if (currentFlashAddress > 0 && currentFlashAddress < m_currentfile_size && sh.Length < 0x1000)
                        {
                            foreach (SymbolHelper cfsh in m_symbols)
                            {
                                if (ShouldTransferSymbol(cfsh))
                                {
                                    if (cfsh.Varname == sh.Varname || cfsh.Userdescription == sh.Varname || sh.Userdescription == cfsh.Varname || (cfsh.Userdescription == sh.Userdescription && sh.Userdescription != ""))
                                    {
                                        // set correct symbolname
                                        string symbolname = cfsh.Varname;
                                        if (symbolname.StartsWith("Symbolnumber"))
                                        {
                                            if (!sh.Varname.StartsWith("Symbolnumber")) symbolname = sh.Varname;
                                            else if (sh.Userdescription != "") symbolname = sh.Userdescription;
                                            else if (cfsh.Userdescription != "") symbolname = cfsh.Userdescription;
                                        }
                                        if (SymbolInTransferCollection(frmtransfer.Symbols, symbolname))
                                        {
                                            //progress.SetProgress("Transferring: " + symbolname);
                                            barProgress.Caption = "Transferring: " + symbolname;
                                            barProgress.EditValue = 50;
                                            System.Windows.Forms.Application.DoEvents();

                                            CopySymbol(symbolname, m_currentfile, (int)GetSymbolAddress(m_symbols, cfsh.Varname), cfsh.Length, filename, (int)currentFlashAddress, sh.Length);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    //progress.SetProgress("Starting report...");
                    barProgress.Caption = "Starting report...";
                    barProgress.EditValue = 80;
                    System.Windows.Forms.Application.DoEvents();

                    UpdateChecksum(filename);
                    verifychecksum(false);
                    SetStatusText("Idle.");
                    barProgress.EditValue = 0;
                    barProgress.Caption = "Done";
                    barProgress.Visibility = BarItemVisibility.Never;
                    //progress.Close();
                }
            }
        }
예제 #4
0
        void InitSkins()
        {
            /*
            ribbonControl1.ForceInitialize();
            BarButtonItem item;

            DevExpress.Skins.SkinManager.Default.RegisterAssembly(typeof(DevExpress.UserSkins.BonusSkins).Assembly);
            DevExpress.Skins.SkinManager.Default.RegisterAssembly(typeof(DevExpress.UserSkins.OfficeSkins).Assembly);

            foreach (DevExpress.Skins.SkinContainer cnt in DevExpress.Skins.SkinManager.Default.Skins)
            {
                item = new BarButtonItem();
                item.Caption = cnt.SkinName;
                //iPaintStyle.AddItem(item);
                ribbonPageGroup13.ItemLinks.Add(item);
                item.ItemClick += new ItemClickEventHandler(OnSkinClick);
            }*/

            ribbonControl1.ForceInitialize();
            BarButtonItem item;
            int skinCount = 0;
            DevExpress.Skins.SkinManager.Default.RegisterAssembly(typeof(DevExpress.UserSkins.BonusSkins).Assembly);
            DevExpress.Skins.SkinManager.Default.RegisterAssembly(typeof(DevExpress.UserSkins.OfficeSkins).Assembly);
            SymbolCollection symcol = new SymbolCollection();
            foreach (DevExpress.Skins.SkinContainer cnt in DevExpress.Skins.SkinManager.Default.Skins)
            {
                SymbolHelper sh = new SymbolHelper();
                sh.Varname = cnt.SkinName;
                symcol.Add(sh);
            }
            symcol.SortColumn = "Varname";
            symcol.SortingOrder = GenericComparer.SortOrder.Ascending;
            symcol.Sort();
            foreach (SymbolHelper sh in symcol)
            {
                item = new BarButtonItem();
                item.Caption = sh.Varname;
                BarItemLink il = ribbonPageGroup13.ItemLinks.Add(item);
                if ((skinCount++ % 3) == 0) il.BeginGroup = true;

                item.ItemClick += new ItemClickEventHandler(OnSkinClick);
            }
            try
            {
                if (IsChristmasTime())
                {
                    // set chrismas skin
                    DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Xmas 2008 Blue"); // don't save
                }
                else if (IsHalloweenTime())
                {
                    // set Halloween skin
                    DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Pumpkin"); // don't save
                }
                else if (IsValetineTime())
                {
                    DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("Valentine"); // don't save
                }
                else
                {
                    DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(m_appSettings.Skinname);
                }
            }
            catch (Exception E)
            {
                logger.Debug(E.Message);
            }
            SetToolstripTheme();
        }
예제 #5
0
        private void OpenFile(string filename, bool showmessage)
        {
            m_fileiss19 = false;
            m_currentsramfile = string.Empty; // geen sramfile erbij
            barStaticItem1.Caption = "";
            if (filename.ToUpper().EndsWith(".S19"))
            {
                m_fileiss19 = true;
                srec2bin convert = new srec2bin();
                string convertedfile = string.Empty;
                if (convert.ConvertSrecToBin(filename, out convertedfile))
                {
                    filename = convertedfile;
                }
                else
                {
                    frmInfoBox info = new frmInfoBox("Failed to convert S19 file to binary");
                }
            }

            FileInfo fi = new FileInfo(filename);
            try
            {
                fi.IsReadOnly = false;
            }
            catch (Exception E)
            {
                logger.Debug("Failed to clear readonly flag: " + E.Message);
                // failed
            }

            m_currentfile = filename;
            m_appSettings.Lastfilename = m_currentfile;
            if (ValidateFile())
            {
                m_symbols = new SymbolCollection();
                t7file = TryToOpenFileUsingClass(m_currentfile, out m_symbols, m_currentfile_size, true);
                SetProgressPercentage(70);
                SetProgress("Sorting data");
                System.Windows.Forms.Application.DoEvents();
                m_symbols.SortColumn = "Length";
                m_symbols.SortingOrder = GenericComparer.SortOrder.Descending;
                m_symbols.Sort();
                SetProgressPercentage(80);
                SetProgress("Loading data into view");
                gridControlSymbols.DataSource = m_symbols;
                //gridViewSymbols.BestFitColumns();
                SetDefaultFilters();
                Text = String.Format("T7SuitePro v{0} [ {1} ]", System.Windows.Forms.Application.ProductVersion, Path.GetFileName(m_currentfile));
                SetProgressPercentage(90);
                SetProgress("Loading realtime info");
                // also rearrange the symbolnumbers in the realtime view
                UpdateRealTimeDataTableWithNewSRAMValues();
                SetProgressPercentage(100);
                System.Windows.Forms.Application.DoEvents();
            }
            else
            {
                m_symbols = new SymbolCollection();
                gridControlSymbols.DataSource = m_symbols;
                Text = String.Format("T7SuitePro v{0} [ none ]", System.Windows.Forms.Application.ProductVersion);
                if (showmessage)
                {
                    frmInfoBox info = new frmInfoBox("File is not a Trionic 7 binary file!");
                }
                m_currentfile = string.Empty;
            }
            logger.Debug("Number of symbols loaded: " + m_symbols.Count);

            try
            {
                int _width = 18;
                int _height = 16;
                if (m_appSettings.AutoCreateAFRMaps)
                {
                    GetTableMatrixWitdhByName(m_currentfile, m_symbols, "BFuelCal.Map", out _width, out _height);
                    m_AFRMap.RpmYSP = GetSymbolAsIntArray("BFuelCal.RpmYSP");
                    m_AFRMap.AirXSP = GetSymbolAsIntArray("BFuelCal.AirXSP");
                    m_AFRMap.InitializeMaps(_width * _height, m_currentfile);
                }
            }
            catch (Exception E)
            {
                logger.Debug("Failed to load AFR maps: " + E.Message);
            }

            try
            {
                T7FileHeader t7header = new T7FileHeader();
                t7header.init(m_currentfile, false);
                if(CheckFileInLibrary(t7header.getPartNumber()))
                {
                    btnCompareToOriginal.Enabled = true;
                }
                else btnCompareToOriginal.Enabled = false;
            }
            catch (Exception E)
            {
                logger.Debug(E.Message);
            }

            if (m_currentfile != string.Empty) LoadRealtimeTable();
            // <GS-07072011> If the opened file is a BioPower file, then BFuelCal.StartMap = the actual fuel E85 map
            if (IsBinaryBiopower())
            {
                barButtonItem67.Caption = "Petrol VE Map";
                barButtonItem69.Caption = "E85 VE Map";
            }
            else
            {
                barButtonItem67.Caption = "VE map";
                barButtonItem69.Caption = "Startup VE map";
            }

            DynamicTuningMenu();

            System.Windows.Forms.Application.DoEvents();
        }
예제 #6
0
        private void TransferMapsToNewBinary(string filename)
        {
            SymbolCollection curSymbolCollection = new SymbolCollection();
            //AddressLookupCollection curAddressLookupCollection = new AddressLookupCollection();
            resumeTuning = new System.Data.DataTable();
            resumeTuning.Columns.Add("Description");

            if (filename != string.Empty)
            {
                frmTransferSelectionSymbolsSelection frmtransfer = new frmTransferSelectionSymbolsSelection();
                SymbolCollection _onlyFlashSymbols = new SymbolCollection();
                foreach (SymbolHelper shcopy in m_symbols)
                {
                    if (shcopy.Flash_start_address > 0 && GetSymbolAddress(m_symbols, shcopy.Varname) < 1048576 && shcopy.Length > 0 && CanTransfer(shcopy))
                    {
                        _onlyFlashSymbols.Symbols.Add(shcopy);
                    }
                }
                frmtransfer.Symbols = /*m_symbols*/_onlyFlashSymbols;
                if (frmtransfer.ShowDialog() == DialogResult.OK)
                {
                    SetProgress("Initializing");
                    SetProgress("Creating backup file...");
                    File.Copy(filename, Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename) + DateTime.Now.ToString("yyyyMMddHHmmss") + "beforetransferringmaps.bin", true);
                    AddToResumeTable("Backup file created (" + Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename) + DateTime.Now.ToString("yyyyMMddHHmmss") + "beforetransferringmaps.bin)");
                    AddToResumeTable("Transferring data from " + Path.GetFileName(m_currentfile) + " to " + filename);

                    bool m_fileparsed = false;

                    //listView1.Items.Clear();
                    SetStatusText("Start symbol parsing");

                    FileInfo fi = new FileInfo(filename);
                    TryToOpenFile(filename, out curSymbolCollection, (int)fi.Length);

                    curSymbolCollection.SortColumn = "Flash_start_address";
                    curSymbolCollection.SortingOrder = GenericComparer.SortOrder.Ascending;
                    curSymbolCollection.Sort();
                    SetProgress("Start transfer");
                    int symidx = 0;
                    foreach (SymbolHelper sh in curSymbolCollection)
                    {
                        if (sh.Flash_start_address > 0 && sh.Flash_start_address < m_currentfile_size && sh.Length < 0x1000)
                        {
                            foreach (SymbolHelper cfsh in m_symbols)
                            {
                                string symbolname = cfsh.SmartVarname;
                                if (symbolname.Contains("."))
                                {
                                    string currentSymbolname = sh.SmartVarname;
                                    if (symbolname == currentSymbolname)
                                    {
                                        if (SymbolInTransferCollection(frmtransfer.Symbols, symbolname))
                                        {
                                            SetProgress("Transferring: " + currentSymbolname);
                                            int percentage = symidx * 100 / curSymbolCollection.Count;
                                            SetProgressPercentage(percentage);
                                            CopySymbol(currentSymbolname, m_currentfile, (int)cfsh.Flash_start_address, cfsh.Length, filename, (int)sh.Flash_start_address, sh.Length);
                                        }
                                    }
                                }
                            }
                        }
                        symidx++;
                    }

                    UpdateChecksum(filename, m_appSettings.AutoChecksum);
                    SetStatusText("Idle.");
                    SetProgressIdle();
                }

            }
        }
예제 #7
0
 private void barButtonItem21_ItemClick(object sender, ItemClickEventArgs e)
 {
     m_symbols = new SymbolCollection();
     TryToOpenFile(m_currentfile, out m_symbols, m_currentfile_size);
     m_symbols.SortColumn = "Length";
     m_symbols.SortingOrder = GenericComparer.SortOrder.Descending;
     m_symbols.Sort();
     gridControlSymbols.DataSource = m_symbols;
 }
예제 #8
0
 private bool SequenceOf576Maps(SymbolCollection sc, int seq1, int seq2, int seq3, int seq4, int seq5, int seq6)
 {
     bool retval = true;
     // get the sequence of 576 lengths maps
     sc.SortColumn = "Symbol_number";
     sc.SortingOrder = GenericComparer.SortOrder.Ascending;
     sc.Sort();
     int idx = 0;
     int[] _seq = new int[32];
     foreach (SymbolHelper sh in sc)
     {
         if (sh.Length == 576)
         {
             _seq[idx] = sh.Symbol_number;
             idx++;
         }
     }
     int[] rseq = new int[32];
     for (int i = 0; i < 32; i++) rseq[i] = 1;
     idx = 0;
     int idx2 = 0;
     for (idx = 0; idx < 9; idx++)
     {
         if (idx < _seq.Length - 1)
         {
             if (Math.Abs(_seq[idx] - _seq[idx + 1]) == 1)
             {
                 rseq[idx2++] = 2;
                 idx++;
             }
             else
             {
                 rseq[idx2++] = 1;
             }
         }
     }
     if (rseq[0] != seq1) retval = false;
     if (rseq[1] != seq2) retval = false;
     if (rseq[2] != seq3) retval = false;
     if (rseq[3] != seq4) retval = false;
     if (rseq[4] != seq5) retval = false;
     if (rseq[5] != seq6) retval = false;
     return retval;
 }
예제 #9
0
 private bool SequenceOf512Maps(SymbolCollection sc, int seq1, int seq2, int seq3, int seq4, int seq5, int seq6)
 {
     bool retval = true;
     // get the sequence of 512 lengths maps
     sc.SortColumn = "Symbol_number";
     sc.SortingOrder = GenericComparer.SortOrder.Ascending;
     sc.Sort();
     int idx = 0;
     int[] _seq = new int[9];
     foreach (SymbolHelper sh in sc)
     {
         if (sh.Length == 512)
         {
             _seq[idx] = sh.Symbol_number;
             idx++;
         }
     }
     // example:
     /*
     KnkFuelCal.fi_MaxOffsetMap	1039 	1
     TrqMastCal.m_AirTorqMap		2344	2
     TrqMastCal.X_AccPedalMAP	2345
     BstKnkCal.MaxAirmass		3192	1
     PedalMapCal.Trq_RequestMap	5820	2
     PedalMapCal.Trq_RequestSportMap	5821
     KnkDetCal.fi_knkWinOffsMAP	6749	2
     KnkDetCal.fi_knkWinSizeMAP	6750
     InjAnglCal.Map			6815	1             * */
     int[] rseq = new int[6];
     for (int i = 0; i < 6; i++) rseq[i] = 1;
     idx = 0;
     int idx2 = 0;
     for (idx = 0; idx < 9; idx++)
     {
         if (idx < _seq.Length - 1)
         {
             if (Math.Abs(_seq[idx] - _seq[idx + 1]) == 1)
             {
                 rseq[idx2++] = 2;
                 idx++;
             }
             else
             {
                 rseq[idx2++] = 1;
             }
         }
     }
     if (rseq[0] != seq1) retval = false;
     if (rseq[1] != seq2) retval = false;
     if (rseq[2] != seq3) retval = false;
     if (rseq[3] != seq4) retval = false;
     if (rseq[4] != seq5) retval = false;
     if (rseq[5] != seq6) retval = false;
     return retval;
 }
예제 #10
0
        public bool CheckAndFillCollection(SymbolCollection sc)
        {
            bool retval = false;
            // first check whether we have a "blank" file
            bool _hasSymbolNumbers = false;
            sc.SortColumn = "Symbol_number";
            sc.SortingOrder = GenericComparer.SortOrder.Ascending;
            sc.Sort();
            foreach (SymbolHelper sh in sc)
            {
                if (sh.Varname.StartsWith("Symbolnumber"))
                {
                    _hasSymbolNumbers = true;
                    break;
                }
            }
            // check known symbol length
            if (_hasSymbolNumbers)
            {
                int MapIndex = 0;

                int KnkFuelCalfi_MaxOffsetMap_Index = 0;
                int TrqMastCalm_AirTorqMap_Index = 0;
                int TrqMastCalX_AccPedalMAP_Index = 0;
                int BstKnkCalMaxAirmass_Index = 0;
                int BstKnkCalMaxAirmassAu_Index = 0;
                int PedalMapCalTrq_RequestMap_Index = 0;
                int PedalMapCalTrq_RequestSportMap_Index = 0;
                int KnkDetCalfi_knkWinOffsMAP_Index = 0;
                int KnkDetCalfi_knkWinSizeMAP_Index = 0;
                int InjAnglCalMap_Index = 0;
                bool _reverse288Maps = false;

                if (SequenceOf512Maps(sc, 1, 2, 1, 2, 2, 1))
                {
                    if (SequenceOf576Maps(sc, 1, 1, 1, 2, 1, 2)) // new file from JZW
                    {
                        //2 = KnkDetCal.fi_KnkWinOffsMap
                        //3 = KnkDetCal.fi_KnkWinSizeMap
                        //7 = TrqMastCal.m_AirTorqMap
                        //8 = TrqMastCal.X_AccPedalMAP

                        KnkFuelCalfi_MaxOffsetMap_Index = 4;
                        KnkDetCalfi_knkWinOffsMAP_Index = 2;
                        KnkDetCalfi_knkWinSizeMAP_Index = 3;

                        InjAnglCalMap_Index = 1;

                        PedalMapCalTrq_RequestMap_Index = 5;
                        PedalMapCalTrq_RequestSportMap_Index = 6;
                        TrqMastCalm_AirTorqMap_Index = 7;
                        TrqMastCalX_AccPedalMAP_Index = 8;
                        BstKnkCalMaxAirmass_Index = 9;
                        _reverse288Maps = true;

                    }
                    else
                    {
                        KnkFuelCalfi_MaxOffsetMap_Index = 1;
                        TrqMastCalm_AirTorqMap_Index = 2;
                        TrqMastCalX_AccPedalMAP_Index = 3;
                        BstKnkCalMaxAirmass_Index = 4;
                        PedalMapCalTrq_RequestMap_Index = 5;
                        PedalMapCalTrq_RequestSportMap_Index = 6;
                        KnkDetCalfi_knkWinOffsMAP_Index = 7;
                        KnkDetCalfi_knkWinSizeMAP_Index = 8;
                        InjAnglCalMap_Index = 9;
                    }
                }
                else if (SequenceOf512Maps(sc, 2, 1, 1, 2, 1, 2))
                {
                    BstKnkCalMaxAirmass_Index = 1;
                    BstKnkCalMaxAirmassAu_Index = 2;
                    InjAnglCalMap_Index = 3;
                    KnkFuelCalfi_MaxOffsetMap_Index = 4;
                    KnkDetCalfi_knkWinOffsMAP_Index = 5;
                    KnkDetCalfi_knkWinSizeMAP_Index = 6;
                    PedalMapCalTrq_RequestMap_Index = 7;
                    TrqMastCalm_AirTorqMap_Index = 8;
                    TrqMastCalX_AccPedalMAP_Index = 9;
                }
                else
                {
                    BstKnkCalMaxAirmass_Index = 1;
                    TrqMastCalm_AirTorqMap_Index = 2;
                    TrqMastCalX_AccPedalMAP_Index = 3;
                    InjAnglCalMap_Index = 4;
                    KnkFuelCalfi_MaxOffsetMap_Index = 5;
                    PedalMapCalTrq_RequestMap_Index = 6;
                    PedalMapCalTrq_RequestSportMap_Index = 7;
                    KnkDetCalfi_knkWinOffsMAP_Index = 8;
                    KnkDetCalfi_knkWinSizeMAP_Index = 9;
                }

                // set the 512 map indexes correctly
                /*
            2008 file: (1,2,1,2,2,1)

            9*512 map

            KnkFuelCal.fi_MaxOffsetMap	1039 	1
            TrqMastCal.m_AirTorqMap		2344	2
            TrqMastCal.X_AccPedalMAP	2345
            BstKnkCal.MaxAirmass		3192	1
            PedalMapCal.Trq_RequestMap	5820	2
            PedalMapCal.Trq_RequestSportMap	5821
            KnkDetCal.fi_knkWinOffsMAP	6749	2
            KnkDetCal.fi_knkWinSizeMAP	6750
            InjAnglCal.Map			6815	1

            2007 file: (2,1,1,2,1,2)

            9*512 map
            BstKnkCal.MaxAirmass		316
            BstKnkCal.MaxAirmassAu		317
            InjAnglCal.Map			2489
            KnkFuelCal.fi_MaxOffsetMap	2517
            KnkDetCal.fi_knkWinOffsMAP	3311
            KnkDetCal.fi_knkWinSizeMAP	3312
            PedalMapCal.Trq_RequestMap	5962
            TrqMastCal.m_AirTorqMap		6254
            TrqMastCal.X_AccPedalMAP	6255

            Non working file 2007: (1,2,1,1,2,2)

            BstKnkCal.MaxAirmass		512		1
            TrqMastCal.m_AirTorqMap		2186		2
            TrqMastCal.X_AccPedalMAP	2187
            InjAnglCal.Map			2981		1
            KnkFuelCal.fi_MaxOffsetMap	4496		1
            PedalMapCal.Trq_RequestMap	5771		2
            PedalMapCal.Trq_RequestSportMap	5772
            KnkDetCal.fi_knkWinOffsMAP	6373		2
            KnkDetCal.fi_knkWinSizeMAP	6374

                 * */

                MapIndex = SetMapName(sc, 70, 1, "FCutCal.FuelFactorMAP");
                SetMapNameByIndex(sc, MapIndex - 1, 10, "FCutCal.T_EngineSP");
                SetMapNameByIndex(sc, MapIndex - 2, 14, "FCutCal.nCombSinceFuelCutSP");
                SetMapNameByIndex(sc, MapIndex - 6, 2, "FCutCal.m_AirInletTime");
                SetMapNameByIndex(sc, MapIndex - 7, 2, "FCutCal.m_AirInletLimit");

                MapIndex = SetMapName(sc, 504, 1, "AfterStCal.StartMAP");
                SetMapNameByIndex(sc, MapIndex + 1, 28, "AfterStCal.n_CombXSP");
                SetMapNameByIndex(sc, MapIndex + 2, 36, "AfterStCal.T_EngineYSP");
                SetMapNameByIndex(sc, MapIndex + 3, 112, "AfterStCal.AmbientMAP");
                SetMapNameByIndex(sc, MapIndex + 4, 8, "AfterStCal.p_AirAmbientYSP");

                SetMapName(sc, 480, 1, "EngTipLimCal.X_Koeff");
                SetMapName(sc, 672, 1, "EngTipNormCal.Trq_BacklashTipOutMap");
                SetMapName(sc, 672, 2, "EngTipSportCal.Trq_BacklashTipOutMap");

                // very probable
                SetMapName(sc, 512, /*1*/ KnkFuelCalfi_MaxOffsetMap_Index, "KnkFuelCal.fi_MaxOffsetMap");
                MapIndex = SetMapName(sc, 512, /*2*/ TrqMastCalm_AirTorqMap_Index, "TrqMastCal.m_AirTorqMap");
                SetMapNameByIndex(sc, MapIndex -2, 576, "TrqMastCal.Trq_MBTMAP"); // maybe use search first match from current index
                SetMapNameByIndex(sc, MapIndex -1, 576, "TrqMastCal.Trq_NominalMap");
                SetMapNameByIndex(sc, MapIndex + 1, 512, "TrqMastCal.X_AccPedalMAP");
                SetMapNameByIndex(sc, MapIndex + 2, 72, "TrqMastCal.IgnAngleDiffSP");
                SetMapNameByIndex(sc, MapIndex + 3, 72, "TrqMastCal.TLO_TAB");
                SetMapNameByIndex(sc, MapIndex + 4, 32, "TrqMastCal.n_EngineYSP"); // TrqMastCal.n_EngineYSP/n_EngYSP
                SetMapNameByIndex(sc, MapIndex + 5, 32, "TrqMastCal.n_EngineXSP");
                SetMapNameByIndex(sc, MapIndex + 6, 8, "TrqMastCal.n_MaxDerXSP");
                SetMapNameByIndex(sc, MapIndex + 7, 32, "TrqMastCal.Trq_EngXSP");
                SetMapNameByIndex(sc, MapIndex + 8, 32, "TrqMastCal.Trq_PedYSP");
                SetMapNameByIndex(sc, MapIndex + 9, 32, "TrqMastCal.Trq_MaxDerIncMAP");
                SetMapNameByIndex(sc, MapIndex + 10, 32, "TrqMastCal.Trq_MaxDerDecMAP");
                SetMapNameByIndex(sc, MapIndex + 11, 2, "TrqMastCal.Trq_MaxDerShift");
                SetMapNameByIndex(sc, MapIndex + 12, 36, "TrqMastCal.m_AirXSP");

                SetMapName(sc, 512, /*3*/ TrqMastCalX_AccPedalMAP_Index, "TrqMastCal.X_AccPedalMAP");
                MapIndex = SetMapName(sc, 512, /*4*/ BstKnkCalMaxAirmass_Index, "BstKnkCal.MaxAirmass");
                SetMapNameByIndex(sc, MapIndex - 1, 32, "BstKnkCal.n_EngYSP");
                SetMapNameByIndex(sc, MapIndex - 2, 32, "BstKnkCal.OffsetXSP");
                if (BstKnkCalMaxAirmassAu_Index > 0)
                {
                    MapIndex = SetMapName(sc, 512, /*4*/ BstKnkCalMaxAirmassAu_Index, "BstKnkCal.MaxAirmassAu");
                }

                SetMapName(sc, 512, /*5*/ PedalMapCalTrq_RequestMap_Index, "PedalMapCal.Trq_RequestMap");
                if (PedalMapCalTrq_RequestSportMap_Index > 0)
                {
                    SetMapName(sc, 512, /*6*/ PedalMapCalTrq_RequestSportMap_Index, "PedalMapCal.Trq_RequestSportMap");
                }
                SetMapName(sc, 512, /*7*/ KnkDetCalfi_knkWinOffsMAP_Index, "KnkDetCal.fi_knkWinOffsMAP");
                SetMapName(sc, 512, /*8*/ KnkDetCalfi_knkWinSizeMAP_Index, "KnkDetCal.fi_knkWinSizeMAP");
                MapIndex = SetMapName(sc, 512, /*9*/ InjAnglCalMap_Index, "InjAnglCal.Map");
                SetMapNameByIndex(sc, MapIndex - 1, 32, "InjAnglCal.RpmYSP");
                SetMapNameByIndex(sc, MapIndex - 2, 32, "InjAnglCal.AirXSP");

                MapIndex = SetMapName(sc, 384, 1, "AirMassMastCal.m_AirMBTMAP");
                SetMapNameByIndex(sc, MapIndex - 1, 24, "AirMassMastCal.Trq_MBTXSP");
                SetMapNameByIndex(sc, MapIndex - 2, 32, "AirMassMastCal.n_EngMBTYSP");

                MapIndex = SetMapName(sc, 384, 2, "IgnAbsCal.fi_IgnMBTMAP");
                SetMapNameByIndex(sc, MapIndex - 1, 32, "IgnAbsCal.n_EngMBTYSP");
                SetMapNameByIndex(sc, MapIndex - 2, 24, "IgnAbsCal.m_AirMBTXSP");
                SetMapNameByIndex(sc, MapIndex + 1, 576, "IgnAbsCal.fi_highOctanMAP");
                SetMapNameByIndex(sc, MapIndex + 2, 576, "IgnAbsCal.fi_lowOctanMAP");
                SetMapNameByIndex(sc, MapIndex + 3, 576, "IgnAbsCal.fi_NormalMAP");
                SetMapNameByIndex(sc, MapIndex + 4, 36, "IgnAbsCal.m_AirNormXSP");
                SetMapNameByIndex(sc, MapIndex + 5, 32, "IgnAbsCal.n_EngNormYSP");

                MapIndex = SetMapName(sc, 320, 1, "IgnAbsCal.fi_FuelCutMAP");
                SetMapNameByIndex(sc, MapIndex - 1, 32, "IgnAbsCal.n_EngFuelCutYSP");
                SetMapNameByIndex(sc, MapIndex - 2, 20, "IgnAbsCal.T_EngFuelCutXSP");
                SetMapNameByIndex(sc, MapIndex + 1, 20, "IgnAbsCal.T_EngStartXSP");
                SetMapNameByIndex(sc, MapIndex + 2, 16, "IgnAbsCal.n_EngStartYSP");
                SetMapNameByIndex(sc, MapIndex + 3, 160, "IgnAbsCal.fi_StartMAP");

                MapIndex = SetMapName(sc, 306, 1, "OilTempCal.T_SpeedAndLoadDecreaseMap");
                SetMapNameByIndex(sc, MapIndex - 1, 34, "OilTempCal.v_VehicleYSP");
                SetMapNameByIndex(sc, MapIndex - 2, 18, "OilTempCal.T_AirInletXSP");

                //<GS-29082011>
                /*
                        4 maps length 288 (0x120) means biopower for T8.

                        1st = BFuelCal.LambdaOneFacMap
                        2nd = BFuelCal.TempEnrichFacMap
                        3rd = BFuelCal.E85TempEnrichFacMap
                        4th = MAFCal.NormAdjustFacMap
                 * */
                if (SymbolCountOfLength(sc, 288) == 4)
                {
                    // biopower
                    MapIndex = SetMapName(sc, 288, 1, "BFuelCal.LambdaOneFacMap");
                    SetMapNameByIndex(sc, MapIndex - 5, 32, "BFuelCal.RpmYSP");
                    SetMapNameByIndex(sc, MapIndex - 6, 36, "BFuelCal.AirXSP");
                    SetMapName(sc, 288, 2, "BFuelCal.E85TempEnrichFacMap");
                    SetMapName(sc, 288, 3, "BFuelCal.TempEnrichFacMap");
                    SetMapName(sc, 288, 4, "MAFCal.NormAdjustFacMap");
                }
                else
                {
                    if (!_reverse288Maps)
                    {
                        MapIndex = SetMapName(sc, 288, 1, "BFuelCal.LambdaOneFacMap");
                        SetMapNameByIndex(sc, MapIndex - 5, 32, "BFuelCal.RpmYSP");
                        SetMapNameByIndex(sc, MapIndex - 6, 36, "BFuelCal.AirXSP");
                        SetMapName(sc, 288, 2, "BFuelCal.TempEnrichFacMap");
                        SetMapName(sc, 288, 3, "MAFCal.NormAdjustFacMap");
                    }
                    else
                    {
                        MapIndex = SetMapName(sc, 288, 2, "BFuelCal.LambdaOneFacMap");
                        SetMapNameByIndex(sc, MapIndex - 5, 32, "BFuelCal.RpmYSP");
                        SetMapNameByIndex(sc, MapIndex - 6, 36, "BFuelCal.AirXSP");
                        SetMapName(sc, 288, 3, "BFuelCal.TempEnrichFacMap");
                        SetMapName(sc, 288, 1, "MAFCal.NormAdjustFacMap");
                    }
                }

                SetMapName(sc, 256, 1, "AirCtrlCal.RegMap");
                MapIndex = SetMapName(sc, 256, 2, "PedalMapCal.GainFactorMap");
                SetMapNameByIndex(sc, MapIndex - 1, 16, "PedalMapCal.GainFactorYSP");
                SetMapNameByIndex(sc, MapIndex - 3, 2, "PedalMapCal.T_SportModeEnable");
                SetMapNameByIndex(sc, MapIndex - 10, 2, "PedalMapCal.SportFactor");
                SetMapNameByIndex(sc, MapIndex - 14, 512, "PedalMapCal.Trq_RequestSportMap");
                SetMapNameByIndex(sc, MapIndex - 15, 512, "PedalMapCal.Trq_RequestMap");
                SetMapNameByIndex(sc, MapIndex - 16, 32, "PedalMapCal.X_PedalMap");
                SetMapNameByIndex(sc, MapIndex - 17, 32, "PedalMapCal.n_EngineMap");

                SetMapName(sc, 224, 1, "MAFCal.WeightConstMap");

                MapIndex = SetMapName(sc, 220, 1, "IgnTempCal.T_AirInletReferenceMap");
                SetMapNameByIndex(sc, MapIndex - 1, 22, "IgnTempCal.n_EngYSP");
                SetMapNameByIndex(sc, MapIndex - 2, 20, "IgnTempCal.m_AirXSP");

                SetMapName(sc, 220, 2, "IgnTempCal.fi_OffsetMaxAirInletMap");
                SetMapName(sc, 220, 3, "IgnTempCal.T_MaxAirInletMap");
                SetMapName(sc, 220, 4, "IgnTempCal.fi_OffsetMinAirInletMap");
                SetMapName(sc, 220, 5, "IgnTempCal.T_MinAirInletMap");
                SetMapName(sc, 220, 6, "IgnTempCal.fi_OffsetMaxTEngMap");
                SetMapName(sc, 220, 7, "IgnTempCal.fi_OffsetMinTEngMap");

                MapIndex = SetMapName(sc, 208, 1, "AfterStCal.HotSoakMAP");
                SetMapNameByIndex(sc, MapIndex + 2, 26, "AfterStCal.t_soakXSP");
                SetMapNameByIndex(sc, MapIndex + 4, 16, "AfterStCal.T_EngineYSP2");

                MapIndex = SetMapName(sc, 204, 1, "IgnMastCal.dwellTimeMap");
                SetMapNameByIndex(sc, MapIndex + 1, 34, "IgnMastCal.n_EngDwellTimeYSP");
                SetMapNameByIndex(sc, MapIndex + 2, 12, "IgnMastCal.UBattDwellTimeXSP");

                MapIndex = SetMapName(sc, 200, 1, "ExhaustCal.T_fiIgnMap");
                SetMapNameByIndex(sc, MapIndex - 1, 20, "ExhaustCal.fi_IgnSP");
                SetMapNameByIndex(sc, MapIndex - 4, 20, "ExhaustCal.m_AirSP");
                SetMapNameByIndex(sc, MapIndex + 1, 576, "ExhaustCal.T_Lambda1Map");
                SetMapNameByIndex(sc, MapIndex + 4, 576, "TrqMastCal.Trq_MBTMAP"); // maybe use search first match from current index
                SetMapNameByIndex(sc, MapIndex + 5, 576, "TrqMastCal.Trq_NominalMap");
                SetMapNameByIndex(sc, MapIndex + 6, 512, "TrqMastCal.m_AirTorqMap");
                SetMapNameByIndex(sc, MapIndex + 7, 512, "TrqMastCal.X_AccPedalMAP");
                SetMapNameByIndex(sc, MapIndex + 8, 72, "TrqMastCal.IgnAngleDiffSP");
                SetMapNameByIndex(sc, MapIndex + 9, 72, "TrqMastCal.TLO_TAB");
                SetMapNameByIndex(sc, MapIndex + 10, 32, "TrqMastCal.n_EngYSP");
                SetMapNameByIndex(sc, MapIndex + 11, 32, "TrqMastCal.n_EngXSP");
                SetMapNameByIndex(sc, MapIndex + 12, 8, "TrqMastCal.n_MaxDerXSP");
                SetMapNameByIndex(sc, MapIndex + 13, 32, "TrqMastCal.Trq_EngXSP");
                SetMapNameByIndex(sc, MapIndex + 14, 32, "TrqMastCal.Trq_PedYSP");
                SetMapNameByIndex(sc, MapIndex + 15, 32, "TrqMastCal.Trq_MaxDerIncMAP");
                SetMapNameByIndex(sc, MapIndex + 16, 32, "TrqMastCal.Trq_MaxDerDecMAP");
                SetMapNameByIndex(sc, MapIndex + 17, 2, "TrqMastCal.Trq_MaxDerShift");
                SetMapNameByIndex(sc, MapIndex + 18, 36, "TrqMastCal.m_AirXSP");

                MapIndex = SetMapName(sc, 192, 1, "AirCtrlCal.m_AirBoostHighAltOffsMAP");
                SetMapNameByIndex(sc, MapIndex - 1, 24, "AirCtrlCal.p_AirAmbientYSP");
                SetMapNameByIndex(sc, MapIndex - 2, 16, "AirCtrlCal.p_AfterTurbineXSP");
                MapIndex = SetMapName(sc, 192, 2, "IgnMastCal.MinMap");
                SetMapNameByIndex(sc, MapIndex + 1, 24, "IgnMastCal.n_EngYSP");
                SetMapNameByIndex(sc, MapIndex + 2, 16, "IgnMastCal.m_AirXSP");

                MapIndex = SetMapName(sc, 168, 1, "IgnKnkCal.RetardIndexMap");
                SetMapNameByIndex(sc, MapIndex - 1, 24, "IgnKnkCal.n_EngIndexYSP");
                SetMapNameByIndex(sc, MapIndex - 2, 14, "IgnKnkCal.m_AirIndexXSP");
                SetMapNameByIndex(sc, MapIndex - 6, 32, "IgnKnkCal.n_EngYSP");
                SetMapNameByIndex(sc, MapIndex - 7, 36, "IgnKnkCal.m_AirXSP");

                MapIndex = SetMapName(sc, 168, 2, "IgnKnkCal.ARetardIndexMap");
                SetMapNameByIndex(sc, MapIndex + 1, 576, "IgnKnkCal.IndexMap");

                MapIndex = SetMapName(sc, 168, 3, "KnkDetCal.X_hystOffsetMAP");
                MapIndex = SetMapName(sc, 168, 4, "KnkDetCal.X_AHystOffsetMAP");

                MapIndex = SetMapName(sc, 160, 1, "MisfCal.m_LoadLevelMAT");
                SetMapNameByIndex(sc, MapIndex + 1, 36, "MisfCal.m_AirXSP");
                SetMapNameByIndex(sc, MapIndex + 4, 576, "MisfCal.CatOverheatFactorMAT");
                SetMapNameByIndex(sc, MapIndex + 7, 32, "MisfCal.n_EngYSP");
                SetMapNameByIndex(sc, MapIndex + 10, 10, "MisfCal.T_EngXSP");
                if (_reverse288Maps)
                {
                    MapIndex = SetMapName(sc, 576, 12, "KnkFuelCal.EnrichmentMap", 1, 576);
                    SetMapNameByIndex(sc, MapIndex + 1, 576, "KnkFuelCal.fi_OffsetEnrichEnable");
                    SetMapNameByIndex(sc, MapIndex + 2, 576, "KnkFuelCal.fi_MaxOffsetMap");
                    SetMapNameByIndex(sc, MapIndex + 3, 32, "KnkFuelCal.m_AirXSP");

                }
                else
                {
                    MapIndex = SetMapName(sc, 576, 2, "KnkFuelCal.EnrichmentMap", 1, 576);
                    SetMapNameByIndex(sc, MapIndex + 1, 576, "KnkFuelCal.fi_OffsetEnrichEnable");
                    SetMapNameByIndex(sc, MapIndex + 2, 576, "KnkFuelCal.fi_MaxOffsetMap");
                    SetMapNameByIndex(sc, MapIndex + 3, 32, "KnkFuelCal.m_AirXSP");

                }

                SetMapName(sc, 160, 2, "IgnAbsCal.fi_StartMAP");
                SetMapName(sc, 140, 1, "FuelCutInhibitCal.FCIFaultCodeList");
                SetMapName(sc, 130, 1, "VIOSMAFCal.TicksSP");
                SetMapName(sc, 130, 2, "VIOSMAFCal.Q_AirInletTab");
                if (_reverse288Maps)
                {
                    SetMapName(sc, 98, 1, "AirCtrlCal.Ppart_BoostMap");
                    SetMapName(sc, 98, 2, "AirCtrlCal.Ipart_BoostMap");
                    MapIndex = SetMapName(sc, 98, 3, "AirCtrlCal.Dpart_BoostMap");
                }
                else
                {
                    SetMapName(sc, 98, 3, "AirCtrlCal.Ppart_BoostMap");
                    SetMapName(sc, 98, 4, "AirCtrlCal.Ipart_BoostMap");
                    MapIndex = SetMapName(sc, 98, 5, "AirCtrlCal.Dpart_BoostMap");

                }
                SetMapNameByIndex(sc, MapIndex + 1, 14, "AirCtrlCal.PIDXSP");
                SetMapNameByIndex(sc, MapIndex + 2, 14, "AirCtrlCal.PIDYSP");
                SetMapNameByIndex(sc, MapIndex + 3, 2, "AirCtrlCal.IPart_BoostCoAirM1");
                SetMapNameByIndex(sc, MapIndex + 4, 2, "AirCtrlCal.m_IFacMax");
                SetMapNameByIndex(sc, MapIndex + 5, 2, "AirCtrlCal.FilterFactor");
                SetMapNameByIndex(sc, MapIndex + 6, 32, "AirCtrlCal.n_EngYSP");
                SetMapNameByIndex(sc, MapIndex + 7, 2, "AirCtrlCal.Hysteres");
                SetMapNameByIndex(sc, MapIndex + 8, 16, "AirCtrlCal.SetLoadXSP");
                SetMapNameByIndex(sc, MapIndex + 9, 256, "AirCtrlCal.RegMap");

                // find torquelimiters automatically
                int state = 0;
                int symIndex =0;
                int symCounter = 0;
                bool limitersFound = false;
                foreach (SymbolHelper sh in sc)
                {
                    //if (state > 0) logger.Debug("State = " + state.ToString() + " symcount: " + symCounter.ToString());
                    switch (state)
                    {
                        case 0:
                            if (sh.Length == 16) state++;
                            break;
                        case 1:

                            if (sh.Length == 2) state++;
                            else state = 0;
                            break;
                        case 2:
                            if (sh.Length == 32) state++;
                            else state = 0;
                            break;
                        case 3:
                            if (sh.Length == 32) state++;
                            else state = 0;
                            break;
                        case 4:
                            if (sh.Length == 32) state++;
                            else state = 0;
                            break;
                        case 5:
                            if (sh.Length == 32) state++;
                            else state = 0;
                            break;
                        case 6:
                            if (sh.Length == 2) state++;
                            else state = 0;
                            break;
                        case 7:
                            if (sh.Length == 2) state++;
                            else state = 0;
                            break;
                        case 8:
                            if (sh.Length == 2) state++;
                            else state = 0;
                            break;
                        case 9:
                            if (sh.Length == 32) state++;
                            else state = 0;
                            break;
                        case 10:
                            if (sh.Length == 32) state++;
                            else state = 0;
                            break;
                        case 11:
                            symIndex = sh.Symbol_number;
                            break;
                    }
                    symCounter++;
                    if (symIndex > 0) break;
                }
                if (symIndex > 0)
                {
                    logger.Debug("(I) Found index: " + symIndex.ToString());
                    limitersFound = true;
                    // - 11 = TrqLimCal.Trq_ManGear
                    SetMapNameByIndex(sc, symIndex - 11, 16, "TrqLimCal.Trq_ManGear");
                    SetMapNameByIndex(sc, symIndex - 9, 32, "TrqLimCal.Trq_MaxEngineManTab1");
                    SetMapNameByIndex(sc, symIndex - 8, 32, "TrqLimCal.Trq_MaxEngineAutTab1");
                    SetMapNameByIndex(sc, symIndex - 7, 32, "TrqLimCal.Trq_MaxEngineManTab2");
                    SetMapNameByIndex(sc, symIndex - 6, 32, "TrqLimCal.Trq_MaxEngineAutTab2");
                    SetMapNameByIndex(sc, symIndex - 2, 32, "TrqLimCal.n_EngYSP");
                    SetMapNameByIndex(sc, symIndex - 1, 32, "TrqLimCal.Trq_OverBoostTab");

                    SetMapNameByIndex(sc, symIndex + 7, 24, "TrqLimCal.CompressorNoiseYSP");
                    SetMapNameByIndex(sc, symIndex + 8, 6, "TrqLimCal.CompressorNoiseXSP");
                    SetMapNameByIndex(sc, symIndex + 9, 72, "TrqLimCal.Trq_CompressorNoiseRedLimMAP");

                }

                if (!limitersFound)
                {
                    state = 0;
                    symIndex = 0;
                    symCounter = 0;
                    foreach (SymbolHelper sh in sc)
                    {
                        //if (state > 0) logger.Debug("State = " + state.ToString() + " symcount: " + symCounter.ToString());
                        switch (state)
                        {
                            case 0:
                                if (sh.Length == 16) state++;
                                break;
                            case 1:

                                if (sh.Length == 2) state++;
                                else state = 0;
                                break;
                            case 2:
                                if (sh.Length == 32) state++;
                                else state = 0;
                                break;
                            case 3:
                                if (sh.Length == 32) state++;
                                else state = 0;
                                break;
                            case 4:
                                if (sh.Length == 2) state++;
                                else state = 0;
                                break;
                            case 5:
                                if (sh.Length == 2) state++;
                                else state = 0;
                                break;
                            case 6:
                                if (sh.Length == 2) state++;
                                else state = 0;
                                break;
                            case 7:
                                if (sh.Length == 32) state++;
                                else state = 0;
                                break;
                            case 8:
                                if (sh.Length == 32) state++;
                                else state = 0;
                                break;
                            case 9:
                                symIndex = sh.Symbol_number;
                                state++;
                                break;
                            case 10:
                                break;
                        }
                        symCounter++;
                        if (symIndex > 0) break;
                    }
                }
                if (symIndex > 0)
                {
                    logger.Debug("(II) Found index: " + symIndex.ToString());
                    limitersFound = true;
                    // - 9 = TrqLimCal.Trq_ManGear
                    SetMapNameByIndex(sc, symIndex - 9, 16, "TrqLimCal.Trq_ManGear");
                    SetMapNameByIndex(sc, symIndex - 7, 32, "TrqLimCal.Trq_MaxEngineManTab1");
                    SetMapNameByIndex(sc, symIndex - 6, 32, "TrqLimCal.Trq_MaxEngineAutTab1");
                    SetMapNameByIndex(sc, symIndex - 2, 32, "TrqLimCal.n_EngYSP");
                    SetMapNameByIndex(sc, symIndex - 1, 32, "TrqLimCal.Trq_OverBoostTab");
                    SetMapNameByIndex(sc, symIndex + 7, 24, "TrqLimCal.CompressorNoiseYSP");
                    SetMapNameByIndex(sc, symIndex + 8, 6, "TrqLimCal.CompressorNoiseXSP");
                    SetMapNameByIndex(sc, symIndex + 9, 72, "TrqLimCal.Trq_CompressorNoiseRedLimMAP");
                }
                SymbolTranslator st = new SymbolTranslator();
                foreach (SymbolHelper sh in sc)
                {
                    string helptext = string.Empty;
                    XDFCategories cat = XDFCategories.Undocumented;
                    XDFSubCategory sub = XDFSubCategory.Undocumented;
                    sh.Description = st.TranslateSymbolToHelpText(sh.Userdescription, out helptext, out cat, out sub);

                    if (sh.Category == "Undocumented" || sh.Category == "")
                    {
                        sh.createAndUpdateCategory(sh.Userdescription);
                    }
                }
            }
            return retval;
        }