Ejemplo n.º 1
0
        public override void LoadSymbol(string symbolname, IECUFile trionic_file)
        {
            // autonomous
            m_trionic_file = trionic_file;
            m_trionic_file.LibraryPath = Application.StartupPath + "\\Binaries";
            this.IsUpsideDown = true; // always?
            foreach (SymbolHelper sh in m_trionic_file.GetFileInfo().SymbolCollection)
            {
                if (sh.Varname == symbolname)
                {
                    // get data from it
                    IECUFile file = new Trionic5File();
                    file.LibraryPath = Application.StartupPath + "\\Binaries";
                    file.SetAutoUpdateChecksum(m_autoUpdateChecksum);
                    file.SelectFile(m_trionic_file.GetFileInfo().Filename);
                    byte[] symboldata = file.ReadData((uint)sh.Flash_start_address, (uint)sh.Length);
                    //byte[] symboldata = file.readdatafromfile(m_trionic_file.GetFileInfo().Filename, sh.Flash_start_address, sh.Length);
                    this.Map_content = symboldata;
                    this.Map_length = symboldata.Length;
                    this.Filename = m_trionic_file.GetFileInfo().Filename;
                    if (m_trionic_file.IsTableSixteenBits(symbolname))
                    {
                        //this.Map_length /= 2;
                    }
                    this.Map_name = symbolname;
                    this.Correction_factor = m_trionic_file.GetCorrectionFactorForMap(symbolname);
                    this.correction_offset = m_trionic_file.GetOffsetForMap(symbolname);
                    this.SetViewSize(ViewSize.NormalView);
                    //this.Viewtype = Trionic5Tools.ViewType.Easy;
                    // set axis information
                    SymbolAxesTranslator sat = new SymbolAxesTranslator();
                    sat.GetXaxisSymbol(symbolname);
                    sat.GetYaxisSymbol(symbolname);
                    this.X_axisvalues = m_trionic_file.GetMapXaxisValues(symbolname);
                    this.Y_axisvalues = m_trionic_file.GetMapYaxisValues(symbolname);
                    string x = string.Empty;
                    string y = string.Empty;
                    string z = string.Empty;

                    m_trionic_file.GetMapAxisDescriptions(symbolname, out x, out y, out z);

                    this.X_axis_name = x;
                    this.Y_axis_name = y;
                    this.Z_axis_name = z;
                    int columns = 1;
                    int rows = 1;
                    m_trionic_file.GetMapMatrixWitdhByName(symbolname, out columns, out rows);
                    this.ShowTable(columns, m_trionic_file.IsTableSixteenBits(symbolname));

                    break;
                }
            }
            
        }
Ejemplo n.º 2
0
        private void AddFilesToLibrary(string path)
        {
            Application.DoEvents();
            DataTable dt = new DataTable("UserLib");
            dt.Columns.Add("Filename");
            dt.Columns.Add("FilenameNoPath");
            dt.Columns.Add("EngineType");
            dt.Columns.Add("Stage");
            dt.Columns.Add("Injectors");
            dt.Columns.Add("Mapsensor");
            dt.Columns.Add("Torque");
            dt.Columns.Add("E85", Type.GetType("System.Boolean"));
            dt.Columns.Add("T7Valve", Type.GetType("System.Boolean"));
            dt.Columns.Add("Partnumber");
            dt.Columns.Add("SoftwareID");
            dt.Columns.Add("CPU");
            dt.Columns.Add("RAMlocked", Type.GetType("System.Boolean"));
            if (File.Exists(Application.StartupPath + "\\UserLib.xml"))
            {
                dt.ReadXml(Application.StartupPath + "\\UserLib.xml");
            }
            string[] files = Directory.GetFiles(path, "*.bin", SearchOption.AllDirectories);
            foreach (string file in files)
            {
                FileInfo fi = new FileInfo(file);
                this.Text = "User library browser - " + Path.GetFileName(file);
                Application.DoEvents();
                if (fi.Length == 0x20000 || fi.Length == 0x40000)
                {
                    try
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            if (dr["Filename"] != DBNull.Value)
                            {
                                if (dr["Filename"].ToString() == file)
                                {
                                    dt.Rows.Remove(dr);
                                    break;
                                }
                            }
                        }
                        Trionic5File _file = new Trionic5File();
                        _file.SelectFile(file);
                        Trionic5FileInformation m_trionicFileInformation = _file.ParseFile();
                        Trionic5Properties props = _file.GetTrionicProperties();
                        // get information about the file
                        MapSensorType mapsensor = _file.GetMapSensorType(true);
                        ECUFileType fileType = _file.DetermineFileType();
                        //t5p.Enginetype
                        //t5p.Partnumber
                        //t5p.CPUspeed
                        //t5p.SoftwareID
                        //t5p.RAMlocked
                        //TuningStage _stage = m_trionicFile.DetermineTuningStage(out m_maxBoost);
                        int injkonst = _file.GetSymbolAsInt("Inj_konst!");
                        bool m_E85 = false;
                        int max_injection = _file.GetMaxInjection();
                        max_injection *= injkonst;
                        // de maximale waarde uit fuel_map_x_axis! aub
                        byte[] fuelxaxis = _file.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash("Fuel_map_xaxis!"), (uint)m_trionicFileInformation.GetSymbolLength("Fuel_map_xaxis!"));
                        int max_value_x_axis = Convert.ToInt32(fuelxaxis.GetValue(fuelxaxis.Length - 1));
                        if (mapsensor == MapSensorType.MapSensor30)
                        {
                            max_value_x_axis *= 120;
                            max_value_x_axis /= 100;
                        }
                        else if (mapsensor == MapSensorType.MapSensor35)
                        {
                            max_value_x_axis *= 140;
                            max_value_x_axis /= 100;
                        }
                        else if (mapsensor == MapSensorType.MapSensor40)
                        {
                            max_value_x_axis *= 160;
                            max_value_x_axis /= 100;
                        }
                        else if (mapsensor == MapSensorType.MapSensor50)
                        {
                            max_value_x_axis *= 200;
                            max_value_x_axis /= 100;
                        }
                        //Console.WriteLine("max x: " + max_value_x_axis.ToString());
                        float max_support_boost = max_value_x_axis;
                        max_support_boost /= 100;
                        max_support_boost -= 1;
                        float corr_inj = 1.4F / max_support_boost;
                        corr_inj *= 100;
                        //Console.WriteLine("corr_inj = " + corr_inj.ToString());
                        max_injection *= (int)corr_inj;
                        max_injection /= 100;

                        // dtReport.Rows.Add("Max injection: "+ max_injection.ToString());
                        if (max_injection > 7500) m_E85 = true;
                        if (injkonst > 26)
                        {
                            m_E85 = true;
                        }
                        //TODO: nog extra controleren of er andere indicatoren zijn of er E85 gebruikt wordt
                        // we kunnen dit aan de start verrijkingen zien en aan de ontstekingstijdstippen bij
                        // vollast (ontsteking scherper), let op want dit laatste is bij W/M injectie ook zo.
                        // de een na laatste waarde uit Eftersta_fak! geeft een duidelijke indicatie
                        byte[] eftstafak = _file.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash("Eftersta_fak!"), (uint)m_trionicFileInformation.GetSymbolLength("Eftersta_fak!"));
                        if (eftstafak.Length == 15)
                        {
                            int eftstafakvalue = Convert.ToInt32(eftstafak.GetValue(13));
                            if (eftstafakvalue > 170) m_E85 = true;
                        }
                        if (m_E85)
                        {
                            max_injection *= 10;
                            max_injection /= 14;
                            // dtReport.Rows.Add("Probable fuel: E85");
                        }
                        // get peak from insp_mat and multiply by injector constant
                        InjectorType inj_type = InjectorType.Stock;
                        if (max_injection > 5000) inj_type = InjectorType.Stock;
                        else if (max_injection > 3500) inj_type = InjectorType.GreenGiants;
                        else if (max_injection > 2000) inj_type = InjectorType.Siemens630Dekas;
                        else if (max_injection > 1565) inj_type = InjectorType.Siemens875Dekas;
                        else inj_type = InjectorType.Siemens1000cc;

                        // Add info about T5/T7 valve
                        int frek230 = _file.GetSymbolAsInt("Frek_230!");
                        int frek250 = _file.GetSymbolAsInt("Frek_250!");
                        bool T7Valve = false;
                        if (fileType == ECUFileType.Trionic52File)
                        {
                            if (frek230 == 728 || frek250 == 935)
                            {
                                T7Valve = false;
                            }
                            else
                            {
                                T7Valve = true;
                            }
                        }
                        else if (fileType == ECUFileType.Trionic55File)
                        {
                            if (frek230 == 90 || frek250 == 70)
                            {
                                T7Valve = false;
                            }
                            else
                            {
                                T7Valve = true;
                            }
                        }
                        int torque = 0;
                        float m_maxBoost = 0;
                        TuningStage _stage = _file.DetermineTuningStage(out m_maxBoost);

                        PressureToTorque ptt = new PressureToTorque();
                        torque = Convert.ToInt32(ptt.CalculateTorqueFromPressure(m_maxBoost, props.TurboType));
                        dt.Rows.Add(file, Path.GetFileName(file), props.Enginetype, _stage.ToString(), inj_type.ToString(), mapsensor.ToString(), torque.ToString(), m_E85, T7Valve, props.Partnumber, props.SoftwareID, props.CPUspeed, props.RAMlocked);
                    }
                    catch (Exception E)
                    {
                        Console.WriteLine(E.Message);
                    }
                }
            }
            dt.WriteXml(Application.StartupPath + "\\UserLib.xml");
            gridControl1.DataSource = dt;
            gridView1.BestFitColumns();
            this.Text = "User library browser";
        }
Ejemplo n.º 3
0
        private void TuneToStage(string m_currentfile, int stage, double maxBoostValue, double maxBoostFirstGear, double maxBoostSecondGear, double maxBoostFirstGearAUT, double fuelCutLevel, double AutoGearBoxPercentage, bool isLpt, TurboType turboType, InjectorType injectorType, MapSensorType mapSensorType)
        {
            m_resume = new Trionic5Resume();
            m_resume.AddToResumeTable("Tuning your binary to stage: " + stage.ToString());
            // get the software ID from the bainery
            string enginetp = readenginetype(m_currentfile);
            string partnumber = readpartnumber(m_currentfile);
            // look up parameters for this sw id
            PartNumberConverter pnc = new PartNumberConverter();
            ECUInformation ecuinfo = pnc.GetECUInfo(partnumber, enginetp);
            File.Copy(m_currentfile, Path.GetDirectoryName(m_currentfile) + "\\" + Path.GetFileNameWithoutExtension(m_currentfile) + DateTime.Now.ToString("yyyyMMddHHmmss") + "beforetuningtostage" + stage.ToString() + ".bin", true);
            m_resume.AddToResumeTable("Backup file created (" + Path.GetFileNameWithoutExtension(m_currentfile) + DateTime.Now.ToString("yyyyMMddHHmmss") + "beforetuningtostage" + stage.ToString() + ".bin" + ")");

            switch (stage)
            {
                case 1:
                    SetRegKonMatFirstGearManual(m_currentfile, 30);
                    SetRegKonMatSecondGearManual(m_currentfile, 45);
                    SetRegKonMatFirstGearAutomatic(m_currentfile, 30);
                    break;
                case 2:
                    SetRegKonMatFirstGearManual(m_currentfile, 45);
                    SetRegKonMatSecondGearManual(m_currentfile, 45);
                    SetRegKonMatFirstGearAutomatic(m_currentfile, 45);
                    break;
                case 3:
                default:
                    SetRegKonMatFirstGearManual(m_currentfile, 45);
                    SetRegKonMatSecondGearManual(m_currentfile, 45);
                    SetRegKonMatFirstGearAutomatic(m_currentfile, 45);
                    break;
            }

            if (CheckBoostRegulationMapEmpty(m_currentfile))
            {
                // empty reg_kon_mat
                switch (stage)
                {
                    case 1:
                        FillRegulationMapValue(m_currentfile, 45);
                        break;
                    case 2:
                        FillRegulationMapValue(m_currentfile, 45);
                        break;
                    case 3:
                    default:
                        FillRegulationMapValue(m_currentfile, 45);
                        break;
                }
            }
            if (CheckBoostRegulationAUTMapEmpty(m_currentfile))
            {
                switch (stage)
                {
                    case 1:
                        FillRegulationAUTMapValue(m_currentfile, 45);
                        break;
                    case 2:
                        FillRegulationAUTMapValue(m_currentfile, 45);
                        break;
                    case 3:
                    default:
                        FillRegulationAUTMapValue(m_currentfile, 45);
                        break;
                }
            }

            if (CheckPIDControlEmpty(m_currentfile))
            {
                FillDefaultPIDControls(m_currentfile);
            }
            if (CheckPIDControlAUTEmpty(m_currentfile))
            {
                FillDefaultPIDAUTControls(m_currentfile);
            }

            //depending on turbotype!!!

            SetBoostRequestMaps(turboType, injectorType, mapSensorType, m_currentfile, maxBoostValue, AutoGearBoxPercentage, isLpt);

            if (/*!isLpt*/true) // don't if T5.2&& m_currentfile_size > 0x20000
            {
                // should be percentages
               /* SetInjectionMap(m_currentfile,15, 15, 255);
                SetInjectionMap(m_currentfile,14, 15, 253);
                SetInjectionMap(m_currentfile,13, 15, 253);
                SetInjectionMap(m_currentfile,12, 15, 249);
                SetInjectionMap(m_currentfile,11, 15, 248);
                SetInjectionMap(m_currentfile,10, 15, 245);
                SetInjectionMap(m_currentfile,9, 15, 236);

                SetInjectionMap(m_currentfile,15, 14, 255);
                SetInjectionMap(m_currentfile,14, 14, 253);
                SetInjectionMap(m_currentfile,13, 14, 253);
                SetInjectionMap(m_currentfile,12, 14, 235);
                SetInjectionMap(m_currentfile,11, 14, 234);
                SetInjectionMap(m_currentfile,10, 14, 226);
                SetInjectionMap(m_currentfile,9, 14, 225);

                SetInjectionMap(m_currentfile,15, 13, 248);
                SetInjectionMap(m_currentfile,14, 13, 245);
                SetInjectionMap(m_currentfile,13, 13, 245);
                SetInjectionMap(m_currentfile,12, 13, 224);
                SetInjectionMap(m_currentfile,11, 13, 217);
                SetInjectionMap(m_currentfile,10, 13, 205);
                SetInjectionMap(m_currentfile,9, 13, 189);

                SetInjectionMap(m_currentfile,15, 12, 219);
                SetInjectionMap(m_currentfile,14, 12, 215);
                SetInjectionMap(m_currentfile,13, 12, 213);
                SetInjectionMap(m_currentfile,12, 12, 206);
                SetInjectionMap(m_currentfile,11, 12, 205);
                SetInjectionMap(m_currentfile,10, 12, 198);
                SetInjectionMap(m_currentfile,9, 12, 176);

                SetInjectionMap(m_currentfile,15, 11, 198);
                SetInjectionMap(m_currentfile,14, 11, 192);
                SetInjectionMap(m_currentfile,13, 11, 191);
                SetInjectionMap(m_currentfile,12, 11, 190);
                SetInjectionMap(m_currentfile,11, 11, 190);
                SetInjectionMap(m_currentfile,10, 11, 183);
                SetInjectionMap(m_currentfile,9, 11, 163);*/
            }

            IncreaseInjectionKnockMap(m_currentfile, 0, 4);
            IncreaseInjectionKnockMap(m_currentfile, 1, 4);
            IncreaseInjectionKnockMap(m_currentfile, 2, 4);

            //SetIgnitionMap(m_currentfile, 15, 17, 1.5);
            //SetIgnitionMap(m_currentfile, 14, 17, 1.0);
            //SetIgnitionMap(m_currentfile, 13, 17, 0.5);
            //byte fuelcut = (byte)((fuelCutLevel + 1) * 100);
            SetBoostLimitMap(m_currentfile, 254 /* fuelcut */);

            //m_resume.m_resume.AddToResumeTable("Updated fuelcut map to: " + fuelCutLevel.ToString() + " bar");
            byte fglimit = (byte)((maxBoostFirstGear + 1) * 100);
            SetFirstGearLimiter(m_currentfile, fglimit);
            m_resume.AddToResumeTable("Updated first gear limiter (MAN) to: " + maxBoostFirstGear.ToString() + " bar");
            byte fgalimit = (byte)((maxBoostFirstGearAUT + 1) * 100);
            SetFirstGearLimiterAutoTrans(m_currentfile, fgalimit);
            m_resume.AddToResumeTable("Updated first gear limiter (AUT) to: " + maxBoostFirstGearAUT.ToString() + " bar");
            byte sglimit = (byte)((maxBoostSecondGear + 1) * 100);
            SetSecondGearLimiter(m_currentfile, sglimit);
            m_resume.AddToResumeTable("Updated second gear limiter (MAN) to: " + maxBoostSecondGear.ToString() + " bar");
            // <Guido> add Max_regl_temp1 Max_regl_temp2
            SetMaxReglTempValues(m_currentfile, 250);

            try
            {
                Trionic5Anomalies anomalies = new Trionic5Anomalies();
                anomalies.CheckBinForAnomalies(m_currentfile, m_resume, false, true, m_fileInformation );
            }
            catch (Exception E)
            {
                Console.WriteLine("CheckBinForAnomalies: " + E.Message);
            }

            // mark this particular file as tuned to stage X, to prevent running the wizard on this file again!
            //enginetp = enginetp.Substring(0, enginetp.Length - 4);
            //enginetp += "T5S" + stage.ToString();
            //writeenginetype(enginetp);
            WriteTunedToStageMarker(m_currentfile, stage);
            m_resume.AddToResumeTable("Updated binary description with tuned stage");
            Trionic5File file = new Trionic5File();
            file.LibraryPath = Application.StartupPath + "\\Binaries";
            file.SetAutoUpdateChecksum(m_autoUpdateChecksum);
            file.UpdateChecksum(m_currentfile);
        }
Ejemplo n.º 4
0
        private void CompareSymbolTableToFile(string filename, Trionic5Tools.SymbolCollection curSymbolCollection, AddressLookupCollection curAddressLookupCollection, out int numberofsymboldifferent)
        {
            numberofsymboldifferent = 0;
            if (filename != string.Empty)
            {
                //bool m_fileparsed = false;
                SetTaskProgress(0, true);
                SetStatusText("Start symbol parsing");
                // available in repository?
                //ParseFile(progress, filename, curTrionic5Tools.SymbolCollection, curAddressLookupCollection);
                Trionic5File m_CompareToFile = new Trionic5File();
                m_CompareToFile.LibraryPath = Application.StartupPath + "\\Binaries";
                m_CompareToFile.SetAutoUpdateChecksum(m_appSettings.AutoChecksum);

                m_CompareToFile.onDecodeProgress += new IECUFile.DecodeProgress(m_CompareToFile_onDecodeProgress);
                Trionic5FileInformation m_CompareInfo = m_CompareToFile.ParseTrionicFile(filename);
                // available in repository?
                curSymbolCollection = m_CompareInfo.SymbolCollection;
                curAddressLookupCollection = m_CompareInfo.AddressCollection;
                //m_fileparsed = true;
                // AddLogItem("Start symbol export...");
                curSymbolCollection.SortColumn = "Start_address";
                curSymbolCollection.SortingOrder = Trionic5Tools.GenericComparer.SortOrder.Ascending;
                curSymbolCollection.Sort();
                //listView1.SuspendLayout();

                foreach (Trionic5Tools.SymbolHelper sh in curSymbolCollection)
                {
                    float diffperc = 0;
                    int diffabs = 0;
                    float diffavg = 0;
                    if (!CompareSymbolToCurrentFile(sh.Varname, sh.Flash_start_address, sh.Length, filename, out diffperc, out diffabs, out diffavg))
                    {
                        numberofsymboldifferent++;
                    }
                }
                /*if (m_fileparsed)
                {
                    CreateRepositoryItem(filename, curTrionic5Tools.SymbolCollection);
                }*/
                //listView1.ResumeLayout();
                SetTaskProgress(0, false);
                SetStatusText("Idle");
                //barButtonItem14.Enabled = true;
                //progress.Close();

            }
            else
            {
                frmInfoBox info = new frmInfoBox("No file selected, please select one first");
            }
        }
Ejemplo n.º 5
0
 public SelectSymbolEventArgs(int address, int length, string mapname, string filename, bool showdiffmap, SymbolCollection symColl, AddressLookupCollection adrColl, Trionic5File _file, Trionic5FileInformation _fileinfo)
 {
     this._address = address;
     this._length = length;
     this._mapname = mapname;
     this._filename = filename;
     this._showdiffmap = showdiffmap;
     this._symbols = symColl;
     this._addresses = adrColl;
     this.m_CompTrionic5File = _file;
     this.m_CompTrionic5FileInformation = _fileinfo;
 }
Ejemplo n.º 6
0
        private Trionic5File CompareSymbolTable(string filename, Trionic5Tools.SymbolCollection curSymbolCollection, AddressLookupCollection curAddressLookupCollection, DevExpress.XtraGrid.GridControl curGridControl, out Trionic5FileInformation m_CompareInfo)
        {
            //bool m_fileparsed = false;
            //listView1.Items.Clear();
            SetStatusText("Start symbol parsing");
            SetTaskProgress(0, true);
            Trionic5File m_CompareToFile = new Trionic5File();
            m_CompareToFile.LibraryPath = Application.StartupPath + "\\Binaries";
            m_CompareToFile.SetAutoUpdateChecksum(m_appSettings.AutoChecksum);

            m_CompareToFile.SelectFile(filename);
            m_CompareToFile.onDecodeProgress += new IECUFile.DecodeProgress(m_CompareToFile_onDecodeProgress);
            m_CompareInfo = m_CompareToFile.ParseTrionicFile(filename);
            // available in repository?
            curSymbolCollection = m_CompareInfo.SymbolCollection;
            curAddressLookupCollection = m_CompareInfo.AddressCollection;
            //                ParseFile(progress, filename, curTrionic5Tools.SymbolCollection, curAddressLookupCollection);
               // m_fileparsed = true;
            // AddLogItem("Start symbol export...");
            curSymbolCollection.SortColumn = "Start_address";
            curSymbolCollection.SortingOrder = Trionic5Tools.GenericComparer.SortOrder.Ascending;
            curSymbolCollection.Sort();
            // progress.SetProgress("Filling list");
            SetStatusText("Filling list");
            //listView1.SuspendLayout();
            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Columns.Add("SYMBOLNAME");
            dt.Columns.Add("SRAMADDRESS", Type.GetType("System.Int32"));
            dt.Columns.Add("FLASHADDRESS", Type.GetType("System.Int32"));
            dt.Columns.Add("LENGTHBYTES", Type.GetType("System.Int32"));
            dt.Columns.Add("LENGTHVALUES", Type.GetType("System.Int32"));
            dt.Columns.Add("DESCRIPTION");
            dt.Columns.Add("ISCHANGED", Type.GetType("System.Boolean"));
            dt.Columns.Add("CATEGORY", Type.GetType("System.Int32"));
            dt.Columns.Add("DIFFPERCENTAGE", Type.GetType("System.Double"));
            dt.Columns.Add("DIFFABSOLUTE", Type.GetType("System.Int32"));
            dt.Columns.Add("DIFFAVERAGE", Type.GetType("System.Double"));
            dt.Columns.Add("CATEGORYNAME");
            dt.Columns.Add("SUBCATEGORYNAME");

            foreach (Trionic5Tools.SymbolHelper sh in curSymbolCollection)
            {
                float diffperc = 0;
                int diffabs = 0;
                float diffavg = 0;
                if (!CompareSymbolToCurrentFile(sh.Varname, sh.Flash_start_address, sh.Length, filename, out diffperc, out diffabs, out diffavg))
                {
                    dt.Rows.Add(sh.Varname, sh.Start_address, sh.Flash_start_address, sh.Length, sh.Length, m_trionicFileInformation.GetSymbolDescription(sh.Varname), false, (int)m_trionicFileInformation.GetSymbolCategory(sh.Varname), diffperc, diffabs, diffavg, m_trionicFileInformation.GetSymbolCategory(sh.Varname).ToString().Replace("_", " "), m_trionicFileInformation.GetSymbolSubcategory(sh.Varname).ToString().Replace("_", " "));
                }
            }
            curGridControl.DataSource = dt;
            /*if (m_fileparsed)
            {
                CreateRepositoryItem(filename, curTrionic5Tools.SymbolCollection);
            }*/
            //listView1.ResumeLayout();
            SetStatusText("Idle");
            SetTaskProgress(0, false);
            return m_CompareToFile;
            //barButtonItem14.Enabled = true;
        }
Ejemplo n.º 7
0
        private void btnRecreateFile_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // show the transactionlog again and ask the user upto what datetime he wants to rebuild the file
            // first ask a datetime
            frmRebuildFileParameters filepar = new frmRebuildFileParameters();
            if (filepar.ShowDialog() == DialogResult.OK)
            {

                // get the last backup that is older than the selected datetime
                string file2Process = GetBackupOlderThanDateTime(m_CurrentWorkingProject, filepar.SelectedDateTime);
                // now rebuild the file
                // first create a copy of this file
                string tempRebuildFile = m_appSettings.ProjectFolder + "\\" + m_CurrentWorkingProject + "rebuild.bin";
                if (File.Exists(tempRebuildFile))
                {
                    File.Delete(tempRebuildFile);
                }
                // CREATE A BACKUP FILE HERE
                CreateProjectBackupFile();
                File.Copy(file2Process, tempRebuildFile);
                // now do all the transactions newer than this file and older than the selected date time
                IECUFile m_RebuildFile = new Trionic5File();
                m_RebuildFile.LibraryPath = Application.StartupPath + "\\Binaries";

                IECUFileInformation m_RebuildFileInformation = new Trionic5FileInformation();

                m_RebuildFile.SelectFile(tempRebuildFile);
                m_RebuildFileInformation = m_RebuildFile.ParseFile();
                FileInfo fi = new FileInfo(file2Process);
                foreach (TransactionEntry te in m_ProjectTransactionLog.TransCollection)
                {
                    if (te.EntryDateTime >= fi.LastAccessTime && te.EntryDateTime <= filepar.SelectedDateTime)
                    {
                        // apply this change
                        RollForwardOnFile(m_RebuildFile, te);
                    }
                }
                // rename/copy file
                if (filepar.UseAsNewProjectFile)
                {
                    // just delete the current file
                    File.Delete(m_trionicFileInformation.Filename);
                    File.Copy(tempRebuildFile, m_trionicFileInformation.Filename);
                    File.Delete(tempRebuildFile);
                    // done
                }
                else
                {
                    // ask for destination file
                    SaveFileDialog sfd = new SaveFileDialog();
                    sfd.Title = "Save rebuild file as...";
                    sfd.Filter = "Binary files|*.bin";
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        if (File.Exists(sfd.FileName)) File.Delete(sfd.FileName);
                        File.Copy(tempRebuildFile, sfd.FileName);
                        File.Delete(tempRebuildFile);
                    }
                }
                if (m_CurrentWorkingProject != string.Empty)
                {
                    m_ProjectLog.WriteLogbookEntry(LogbookEntryType.ProjectFileRecreated, "Reconstruct upto " + filepar.SelectedDateTime.ToString("dd/MM/yyyy") + " selected file " + file2Process);
                }
                UpdateRollbackForwardControls();
            }
        }
Ejemplo n.º 8
0
        private void TransferMapsToNewBinary(string filename, Trionic5Resume resume)
        {
            IECUFile m_FileToTransferTo = new Trionic5File();
            m_FileToTransferTo.LibraryPath = Application.StartupPath + "\\Binaries";
            m_FileToTransferTo.SetAutoUpdateChecksum(m_appSettings.AutoChecksum);

            m_FileToTransferTo.SelectFile(filename);
            Trionic5FileInformation m_FileInfoToTransferTo = new Trionic5FileInformation();

            if (filename != string.Empty)
            {
                File.Copy(filename, Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename) + DateTime.Now.ToString("yyyyMMddHHmmss") + "beforetransferringmaps.bin", true);
                resume.AddToResumeTable("Backup file created");
                //bool m_fileparsed = false;
                SetStatusText("Start symbol parsing");
                m_FileInfoToTransferTo = m_FileToTransferTo.ParseFile();
                //m_fileparsed = true;

                foreach (Trionic5Tools.SymbolHelper sh in m_FileInfoToTransferTo.SymbolCollection)
                {
                    if (sh.Flash_start_address > 0)
                    {
                        foreach (Trionic5Tools.SymbolHelper cfsh in m_trionicFileInformation.SymbolCollection)
                        {
                            if (cfsh.Varname == sh.Varname)
                            {
                                //progress.SetProgress("Transferring: " + sh.Varname);
                                CopySymbol(sh.Varname, m_trionicFileInformation.Filename, m_FileToTransferTo, cfsh.Flash_start_address, cfsh.Length, filename, sh.Flash_start_address, sh.Length, resume);
                            }
                        }
                    }
                }
                SetStatusText("Idle.");

            }
        }
Ejemplo n.º 9
0
        private void StartCompareMapViewer(string SymbolName, string Filename, int SymbolAddress, int SymbolLength, Trionic5Tools.SymbolCollection curSymbols, AddressLookupCollection curAddresses, Trionic5File curFile, Trionic5FileInformation curFileInfo)
        {
            try
            {
                DevExpress.XtraBars.Docking.DockPanel dockPanel;
                bool pnlfound = false;
                foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                {

                    if (pnl.Text == "Symbol: " + SymbolName + " [" + Path.GetFileName(Filename) + "]")
                    {
                        dockPanel = pnl;
                        pnlfound = true;
                        dockPanel.Show();
                        // nog data verversen?
                    }
                }
                if (!pnlfound)
                {
                    dockManager1.BeginUpdate();
                    try
                    {
                        dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                        dockPanel.Tag = Filename;// m_trionicFile.GetFileInfo().Filename; changed 24/01/2008
                        //IMapViewer tabdet = new MapViewerEx();
                        IMapViewer tabdet;

                        if (m_appSettings.MapViewerType == MapviewerType.Fancy)
                        {
                            tabdet = new MapViewerEx();
                        }
                        else if (m_appSettings.MapViewerType == MapviewerType.Normal)
                        {
                            tabdet = new MapViewer();
                        }
                        else
                        {
                            tabdet = new SimpleMapViewer();
                        }
                        tabdet.AutoUpdateChecksum = m_appSettings.AutoChecksum;
                        tabdet.GraphVisible = m_appSettings.ShowGraphs;
                       // TryTpShowTouchScreenInput();

                        //tabdet.DirectSRAMWriteOnSymbolChange = m_appSettings.DirectSRAMWriteOnSymbolChange;
                       // tabdet.SetViewSize(m_appSettings.DefaultViewSize);

                        //tabdet.IsHexMode = barViewInHex.Checked;
                        tabdet.Viewtype = (Trionic5Tools.ViewType)m_appSettings.DefaultViewType;
                        if (curFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor25)
                        {
                            if (m_appSettings.DefaultViewType == ViewType.Decimal)
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Decimal;
                            }
                            else
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Easy;
                            }
                        }
                        else if (curFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor30)
                        {
                            if (m_appSettings.DefaultViewType == ViewType.Decimal)
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Decimal3Bar;
                            }
                            else
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Easy3Bar;
                            }
                        }
                        else if (curFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor35)
                        {
                            if (m_appSettings.DefaultViewType == ViewType.Decimal)
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Decimal35Bar;
                            }
                            else
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Easy35Bar;
                            }
                        }
                        else if (curFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor40)
                        {
                            if (m_appSettings.DefaultViewType == ViewType.Decimal)
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Decimal4Bar;
                            }
                            else
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Easy4Bar;
                            }
                        }
                        else if (m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor50)
                        {
                            if (m_appSettings.DefaultViewType == ViewType.Decimal)
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Decimal5Bar;
                            }
                            else
                            {
                                tabdet.Viewtype = Trionic5Tools.ViewType.Easy5Bar;
                            }
                        }
                        //tabdet.DisableColors = m_appSettings.DisableMapviewerColors;
                        //tabdet.AutoSizeColumns = m_appSettings.AutoSizeColumnsInWindows;
                        //tabdet.GraphVisible = m_appSettings.ShowGraphs;
                        //tabdet.IsRedWhite = m_appSettings.ShowRedWhite;
                        tabdet.Filename = Filename;
                        tabdet.Map_name = SymbolName;

                        tabdet.Map_descr = m_trionicFileInformation.GetSymbolDescription(tabdet.Map_name);
                        tabdet.Map_cat = m_trionicFileInformation.GetSymbolCategory(tabdet.Map_name);
                        tabdet.X_axisvalues = curFile.GetMapXaxisValues(tabdet.Map_name);
                        tabdet.Y_axisvalues = curFile.GetMapYaxisValues(tabdet.Map_name);
                        string xdescr = string.Empty;
                        string ydescr = string.Empty;
                        string zdescr = string.Empty;
                        // van compare file halen?
                        curFile.GetMapAxisDescriptions(tabdet.Map_name, out xdescr, out ydescr, out zdescr);
                        tabdet.X_axis_name = xdescr;
                        tabdet.Y_axis_name = ydescr;
                        tabdet.Z_axis_name = zdescr;

                        //tabdet.Map_sramaddress = GetSymbolAddressSRAM(SymbolName);
                        int columns = 8;
                        int rows = 8;

                        int tablewidth = curFile.GetTableMatrixWitdhByName(Filename, tabdet.Map_name, out columns, out rows);
                        int address = Convert.ToInt32(SymbolAddress);
                        if (address != 0)
                        {
                            while (address > curFileInfo.Filelength) address -= curFileInfo.Filelength;
                            tabdet.Map_address = address;
                            int length = SymbolLength;
                            tabdet.Map_length = length;
                            byte[] mapdata = curFile.ReadData((uint)address, (uint)length);
                            tabdet.Map_content = mapdata;
                            tabdet.Correction_factor = curFile.GetCorrectionFactorForMap(tabdet.Map_name);
                            tabdet.Correction_offset = curFile.GetOffsetForMap(tabdet.Map_name);
                            tabdet.IsUpsideDown = true;
                            tabdet.ShowTable(columns, curFile.GetFileInfo().isSixteenBitTable(SymbolName));
                            tabdet.Dock = DockStyle.Fill;
                            //tabdet.onSymbolSave += new MapViewer.NotifySaveSymbol(tabdet_onSymbolSave);
                            tabdet.onClose += new IMapViewer.ViewerClose(OnCloseMapViewer);
                            tabdet.onAxisEditorRequested += new IMapViewer.AxisEditorRequested(mv_onAxisEditorRequested);
                            //tabdet.onAxisLock += new MapViewer.NotifyAxisLock(tabdet_onAxisLock);
                            //tabdet.onSliderMove += new MapViewer.NotifySliderMove(tabdet_onSliderMove);
                            tabdet.onSelectionChanged += new IMapViewer.SelectionChanged(tabdet_onSelectionChanged);
                            tabdet.onSurfaceGraphViewChangedEx += new IMapViewer.SurfaceGraphViewChangedEx(mv_onSurfaceGraphViewChangedEx);
                            tabdet.onCellLocked += new IMapViewer.CellLocked(mv_onCellLocked);

                            //tabdet.onSplitterMoved += new MapViewer.SplitterMoved(tabdet_onSplitterMoved);
                            //tabdet.onSurfaceGraphViewChanged += new MapViewer.SurfaceGraphViewChanged(tabdet_onSurfaceGraphViewChanged);
                            //tabdet.onGraphSelectionChanged += new MapViewer.GraphSelectionChanged(tabdet_onGraphSelectionChanged);
                            //tabdet.onViewTypeChanged += new MapViewer.ViewTypeChanged(tabdet_onViewTypeChanged);

                            tabdet.SetViewSize((Trionic5Tools.ViewSize)m_appSettings.DefaultViewSize);
                            //dockPanel.DockAsTab(dockPanel1);
                            //dockPanel.Text = "Symbol: " + SymbolName + " [" + Filename + "]";
                            dockPanel.Text = Path.GetFileName(Filename) + " [" + SymbolName + "]";

                            bool isDocked = false;
                            if (m_appSettings.AutoDockSameSymbol)
                            {
                                foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                                {
                                    if (pnl.Text.Contains("[" + SymbolName +"]") && pnl != dockPanel && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                                    {
                                        dockPanel.DockAsTab(pnl, 0);
                                        //pnl.Options.ShowCloseButton = false;
                                        isDocked = true;
                                        break;
                                    }
                                }
                            }
                            if (!isDocked)
                            {
                                if (m_appSettings.AutoDockSameFile)
                                {
                                    foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                                    {
                                        if ((string)pnl.Tag == m_trionicFileInformation.Filename && pnl != dockPanel && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                                        {
                                            dockPanel.DockAsTab(pnl, 0);
                                            //pnl.Options.ShowCloseButton = false;
                                            isDocked = true;
                                            break;
                                        }
                                    }
                                }
                            }
                            if (!isDocked)
                            {
                                dockPanel.DockTo(dockManager1, DevExpress.XtraBars.Docking.DockingStyle.Right, 0);
                                if (m_appSettings.AutoSizeNewWindows)
                                {
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dockPanel.Width = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                                    }
                                    else
                                    {
                                        //dockPanel.Width = this.Width - dockSymbols.Width - 10;

                                    }
                                }
                                if (dockPanel.Width < 400) dockPanel.Width = 400;
                                //                    dockPanel.Width = 400;
                            }
                            tabdet.InitEditValues();
                            dockPanel.Controls.Add(tabdet);

                        }

                    }
                    catch (Exception E)
                    {
                        Console.WriteLine(E.Message);
                    }
                    dockManager1.EndUpdate();
                }

            }
            catch (Exception startnewcompareE)
            {
                Console.WriteLine(startnewcompareE.Message);
            }
        }
Ejemplo n.º 10
0
        private void StartCompareDifferenceViewer(string SymbolName, string Filename, int SymbolAddress, int SymbolLength, Trionic5File curFile, Trionic5FileInformation curInfo)
        {
            DevExpress.XtraBars.Docking.DockPanel dockPanel;
            bool pnlfound = false;
            foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
            {

                if (pnl.Text == "Symbol difference: " + SymbolName + " [" + Path.GetFileName(Filename) + "]")
                {
                    dockPanel = pnl;
                    pnlfound = true;
                    dockPanel.Show();
                    // nog data verversen?
                    foreach (Control c in dockPanel.Controls)
                    {
                        /* if (c is MapViewer)
                         {
                             MapViewer tempviewer = (MapViewer)c;
                             tempviewer.Map_content
                         }*/
                    }
                }
            }
            if (!pnlfound)
            {
                dockManager1.BeginUpdate();
                try
                {
                    dockPanel = dockManager1.AddPanel(new System.Drawing.Point(-500, -500));
                    dockPanel.Tag = Filename;
                    //IMapViewer tabdet = new MapViewerEx();
                    IMapViewer tabdet;
                    if (m_appSettings.MapViewerType == MapviewerType.Fancy)
                    {
                        tabdet = new MapViewerEx();
                    }
                    else if (m_appSettings.MapViewerType == MapviewerType.Normal)
                    {
                        tabdet = new MapViewer();
                    }
                    else
                    {
                        tabdet = new SimpleMapViewer();
                    }
                    tabdet.AutoUpdateChecksum = m_appSettings.AutoChecksum;
                    tabdet.GraphVisible = m_appSettings.ShowGraphs;
                    tabdet.IsCompareViewer = true;
                    //TryTpShowTouchScreenInput();

                    tabdet.DirectSRAMWriteOnSymbolChange = false;
                    //tabdet.IsHexMode = true; // always in hexmode!
                    if (curFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor25)
                    {
                        if (m_appSettings.DefaultViewType == ViewType.Decimal)
                        {
                            tabdet.Viewtype = Trionic5Tools.ViewType.Decimal;
                        }
                        else
                        {
                            tabdet.Viewtype = Trionic5Tools.ViewType.Easy;
                        }
                    }
                    else if (curFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor30)
                    {
                        if (m_appSettings.DefaultViewType == ViewType.Decimal)
                        {
                            tabdet.Viewtype = Trionic5Tools.ViewType.Decimal3Bar;
                        }
                        else
                        {
                            tabdet.Viewtype = Trionic5Tools.ViewType.Easy3Bar;
                        }
                    }
                    else if (curFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor35)
                    {
                        if (m_appSettings.DefaultViewType == ViewType.Decimal)
                        {
                            tabdet.Viewtype = Trionic5Tools.ViewType.Decimal35Bar;
                        }
                        else
                        {
                            tabdet.Viewtype = Trionic5Tools.ViewType.Easy35Bar;
                        }
                    }
                    else if (curFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor40)
                    {
                        if (m_appSettings.DefaultViewType == ViewType.Decimal)
                        {
                            tabdet.Viewtype = Trionic5Tools.ViewType.Decimal4Bar;
                        }
                        else
                        {
                            tabdet.Viewtype = Trionic5Tools.ViewType.Easy4Bar;
                        }
                    }
                    else if (m_trionicFile.GetMapSensorType(m_appSettings.AutoDetectMapsensorType) == MapSensorType.MapSensor50)
                    {
                        if (m_appSettings.DefaultViewType == ViewType.Decimal)
                        {
                            tabdet.Viewtype = Trionic5Tools.ViewType.Decimal5Bar;
                        }
                        else
                        {
                            tabdet.Viewtype = Trionic5Tools.ViewType.Easy5Bar;
                        }
                    }

                    tabdet.DisableColors = m_appSettings.DisableMapviewerColors;
                    tabdet.AutoSizeColumns = m_appSettings.AutoSizeColumnsInWindows;
                    tabdet.GraphVisible = m_appSettings.ShowGraphs;
                    tabdet.IsRedWhite = m_appSettings.ShowRedWhite;
                    tabdet.Filename = Filename;
                    tabdet.Map_name = SymbolName;

                    tabdet.Map_descr = m_trionicFileInformation.GetSymbolDescription(tabdet.Map_name);
                    tabdet.Map_cat = m_trionicFileInformation.GetSymbolCategory(tabdet.Map_name);
                    tabdet.X_axisvalues = curFile.GetMapXaxisValues(tabdet.Map_name);
                    tabdet.Y_axisvalues = curFile.GetMapYaxisValues(tabdet.Map_name);
                    string xdescr = string.Empty;
                    string ydescr = string.Empty;
                    string zdescr = string.Empty;
                    // van compare file halen?
                    curFile.GetMapAxisDescriptions(tabdet.Map_name, out xdescr, out ydescr, out zdescr);
                    tabdet.X_axis_name = xdescr;
                    tabdet.Y_axis_name = ydescr;
                    tabdet.Z_axis_name = zdescr;

                    //tabdet.Map_sramaddress = GetSymbolAddressSRAM(SymbolName);
                    int columns = 8;
                    int rows = 8;
                    int tablewidth = curFile.GetTableMatrixWitdhByName(Filename, tabdet.Map_name, out columns, out rows);
                    int address = Convert.ToInt32(SymbolAddress);
                    if (address != 0)
                    {
                        while (address > curInfo.Filelength) address -= curInfo.Filelength;
                        tabdet.Map_address = address;
                        int length = SymbolLength;
                        tabdet.Map_length = length;
                        byte[] mapdata = curFile.ReadData((uint)address, (uint)length);
                        byte[] mapdataorig = curFile.ReadData((uint)address, (uint)length);
                        byte[] mapdata2 = m_trionicFile.ReadData((uint)m_trionicFileInformation.GetSymbolAddressFlash(SymbolName), (uint)m_trionicFileInformation.GetSymbolLength(SymbolName));

                        tabdet.Map_original_content = mapdataorig;
                        tabdet.Map_compare_content = mapdata2;

                        if (mapdata.Length == mapdata2.Length)
                        {

                            if (curFile.IsTableSixteenBits(SymbolName))
                            {
                                for (int bt = 0; bt < mapdata2.Length; bt += 2)
                                {
                                    int value1 = Convert.ToInt16(mapdata.GetValue(bt)) * 256 + Convert.ToInt16(mapdata.GetValue(bt + 1));
                                    int value2 = Convert.ToInt16(mapdata2.GetValue(bt)) * 256 + Convert.ToInt16(mapdata2.GetValue(bt + 1));

                                    value1 = (int)Math.Abs(value1 - value2);
                                    //value1 = (int)(value1 - value2);
                                    byte v1 = (byte)(value1 / 256);
                                    byte v2 = (byte)(value1 - (int)v1 * 256);
                                    mapdata.SetValue(v1, bt);
                                    mapdata.SetValue(v2, bt + 1);
                                }
                            }
                            else
                            {
                                for (int bt = 0; bt < mapdata2.Length; bt++)
                                {
                                    //Console.WriteLine("Byte diff: " + mapdata.GetValue(bt).ToString() + " - " + mapdata2.GetValue(bt).ToString() + " = " + (byte)Math.Abs(((byte)mapdata.GetValue(bt) - (byte)mapdata2.GetValue(bt))));
                                    mapdata.SetValue((byte)Math.Abs(((byte)mapdata.GetValue(bt) - (byte)mapdata2.GetValue(bt))), bt);
                                    //mapdata.SetValue((byte)(((byte)mapdata.GetValue(bt) - (byte)mapdata2.GetValue(bt))), bt);
                                }
                            }

                            tabdet.Map_content = mapdata;
                            tabdet.UseNewCompare = true;

                            tabdet.Correction_factor = curFile.GetCorrectionFactorForMap(tabdet.Map_name);
                            tabdet.Correction_offset = curFile.GetOffsetForMap(tabdet.Map_name);
                            tabdet.IsUpsideDown = true;//GetMapUpsideDown(tabdet.Map_name);
                            tabdet.ShowTable(columns, curFile.GetFileInfo().isSixteenBitTable(SymbolName));
                            tabdet.Dock = DockStyle.Fill;
                            //tabdet.onSymbolSave += new MapViewer.NotifySaveSymbol(tabdet_onSymbolSave);
                            tabdet.onClose += new IMapViewer.ViewerClose(OnCloseMapViewer);
                            //tabdet.onAxisLock += new MapViewer.NotifyAxisLock(tabdet_onAxisLock);
                            //tabdet.onSliderMove += new MapViewer.NotifySliderMove(tabdet_onSliderMove);
                            tabdet.onSelectionChanged += new IMapViewer.SelectionChanged(tabdet_onSelectionChanged);
                            tabdet.onSurfaceGraphViewChangedEx += new IMapViewer.SurfaceGraphViewChangedEx(mv_onSurfaceGraphViewChangedEx);
                            tabdet.onCellLocked += new IMapViewer.CellLocked(mv_onCellLocked);

                            //tabdet.onSplitterMoved += new MapViewer.SplitterMoved(tabdet_onSplitterMoved);
                            //tabdet.onSurfaceGraphViewChanged += new MapViewer.SurfaceGraphViewChanged(tabdet_onSurfaceGraphViewChanged);
                            //tabdet.onGraphSelectionChanged += new MapViewer.GraphSelectionChanged(tabdet_onGraphSelectionChanged);
                            //tabdet.onViewTypeChanged += new MapViewer.ViewTypeChanged(tabdet_onViewTypeChanged);
                            tabdet.onAxisEditorRequested += new IMapViewer.AxisEditorRequested(mv_onAxisEditorRequested);
                            //dockPanel.DockAsTab(dockPanel1);
                            dockPanel.Text = "Symbol difference: " + SymbolName + " [" + Path.GetFileName(Filename) + "]";
                            /*bool isDocked = false;
                            if (m_appSettings.AutoDockSameSymbol)
                            {
                                foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                                {
                                    if (pnl.Text.StartsWith("Symbol difference: " + SymbolName) && pnl != dockPanel && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                                    {
                                        dockPanel.DockAsTab(pnl, 0);
                                        //pnl.Options.ShowCloseButton = false;
                                        isDocked = true;
                                        break;
                                    }
                                }
                            }
                            if (!isDocked)
                            {
                                if (m_appSettings.AutoDockSameFile)
                                {
                                    foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                                    {
                                        if ((string)pnl.Tag == m_trionicFileInformation.Filename && pnl != dockPanel && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                                        {
                                            dockPanel.DockAsTab(pnl, 0);
                                            //pnl.Options.ShowCloseButton = false;
                                            isDocked = true;
                                            break;
                                        }
                                    }
                                }
                            }*/
                            bool isDocked = false;
                            if (m_appSettings.AutoDockSameSymbol)
                            {
                                foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                                {
                                    if (pnl.Text.Contains("[" + SymbolName + "]") && pnl != dockPanel && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                                    {
                                        dockPanel.DockAsTab(pnl, 0);
                                        //pnl.Options.ShowCloseButton = false;
                                        isDocked = true;
                                        break;
                                    }
                                }
                            }
                            if (!isDocked)
                            {
                                if (m_appSettings.AutoDockSameFile)
                                {
                                    foreach (DevExpress.XtraBars.Docking.DockPanel pnl in dockManager1.Panels)
                                    {
                                        if ((string)pnl.Tag == m_trionicFileInformation.Filename && pnl != dockPanel && (pnl.Visibility == DevExpress.XtraBars.Docking.DockVisibility.Visible))
                                        {
                                            dockPanel.DockAsTab(pnl, 0);
                                            //pnl.Options.ShowCloseButton = false;
                                            isDocked = true;
                                            break;
                                        }
                                    }
                                }
                            }
                            if (!isDocked)
                            {
                                dockPanel.DockTo(dockManager1, DevExpress.XtraBars.Docking.DockingStyle.Right, 0);
                                if (m_appSettings.AutoSizeNewWindows)
                                {
                                    if (tabdet.X_axisvalues.Length > 0)
                                    {
                                        dockPanel.Width = 30 + ((tabdet.X_axisvalues.Length + 1) * 35);
                                    }
                                    else
                                    {
                                        //dockPanel.Width = this.Width - dockSymbols.Width - 10;

                                    }
                                }
                                if (dockPanel.Width < 400) dockPanel.Width = 400;

                                //                    dockPanel.Width = 400;
                            }
                            tabdet.InitEditValues();
                            dockPanel.Controls.Add(tabdet);

                        }
                        else
                        {
                            frmInfoBox info = new frmInfoBox("Map lengths don't match...");
                        }
                    }
                }
                catch (Exception E)
                {

                    Console.WriteLine(E.Message);
                }
                dockManager1.EndUpdate();
            }
        }