示例#1
0
        public void openDeviceImage(string filename)
        {
            //Construct new romimage
            //TODO move this, application logic shouldn't be in GUI class.
            ECU newImage = new ECU(sharpTuner, filename);

            if (newImage.CalId == null)
            {
                Trace.TraceWarning(String.Format("Unable to identify rom at {0}", newImage.FilePath.ToString()));
                MessageBox.Show("Unable to idenfity rom at " + newImage.FilePath.ToString());
                return;
            }
            foreach (ECU image in sharpTuner.ImageList)
            {
                if (image.FilePath == filename)
                {
                    Console.Write("Rom is already open!");
                    return;
                }
            }
            this.closeDeviceImageToolStripMenuItem.Enabled = true;
            obfuscateCALIDToolStripMenuItem.Enabled        = true;
            sharpTuner.AddImage(newImage);
            this.openDeviceListBox.Items.Add(sharpTuner.activeImage.FileName);
            Trace.WriteLine("Successfully opened " + sharpTuner.activeImage.CalId + " filename: " + sharpTuner.activeImage.FileName);
            Refresh();
        }
示例#2
0
 /// <summary>
 /// Determines which command to run.
 /// </summary>
 private static bool Run(string[] args)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     sharpTuner = new SharpTuner();
     if (args.Length < 1)
     {
         Application.Run(sharpTuner.mainWindow);
         return(true);
     }
     else
     {
         sharpTuner.Init();
         if (args[0] == "ecumaptool")
         {
             return(EcuMapTool.Run(sharpTuner.AvailableDevices, Utils.ShiftLeftTruncate(args)));
         }
         else if (args[0] == "rommod")
         {
             return(SharpTune.RomMod.RomMod.Run(sharpTuner.AvailableDevices, Utils.ShiftLeftTruncate(args)));
         }
         else if (args[0] == "xmlconvertor")
         {
             ECU      di  = new ECU(sharpTuner, args[1]);
             XMLtoIDC xti = new XMLtoIDC(di);
             //TODO clean up this routine: xti.Run(args);
         }
         else if (args.Length == 2 && args[0] == "help")
         {
             PrintHelp_RomMod(args[1]);
             return(true);
         }
     }
     return(false);
 }
示例#3
0
 internal void SetSvkTargetForEachEcu(ISvt svt)
 {
     if (svt == null)
     {
         foreach (EcuProgrammingInfo ecuProgrammingInfo in this.ecuProgrammingInfos)
         {
             ecuProgrammingInfo.SvkTarget = null;
         }
         return;
     }
     foreach (IEcuObj ecuObj in svt.Ecus)
     {
         EcuProgrammingInfo ecuProgrammingInfo2 = this.GetItemFromProgrammingInfos((long)ecuObj.EcuIdentifier.DiagAddrAsInt);
         if (ecuProgrammingInfo2 != null)
         {
             ecuProgrammingInfo2.SvkTarget = ecuObj.StandardSvk;
         }
         else
         {
             ECU ecu = this.programmingObjectBuilder.Build(ecuObj);
             if (ecu != null)
             {
                 ecuProgrammingInfo2           = this.GetEcuProgrammingInfo(ecu);
                 ecuProgrammingInfo2.SvkTarget = ecuObj.StandardSvk;
             }
         }
     }
 }
示例#4
0
        private void mainboardList_MouseUp(object sender, MouseButtonEventArgs e)
        {
            var    item    = sender as ListViewItem;
            string text    = item.Content.ToString();
            ECU    current = ecuList.Find(o => o.uuid == text);

            drawMainboards(current);
        }
示例#5
0
        private EcuProgrammingInfo GetEcuProgrammingInfo(ECU ecuFromTargetSvt)
        {
            EcuProgrammingInfo ecuProgrammingInfo = new EcuProgrammingInfo(ecuFromTargetSvt, this.programmingObjectBuilder, true);

            this.ecuProgrammingInfos.Add(ecuProgrammingInfo);
            this.DataContext.List.Add(ecuProgrammingInfo.Data);
            this.AddProgrammingInfoBeforeReplace(ecuProgrammingInfo.Data);
            this.ecuProgrammingInfosMap.Add(ecuFromTargetSvt, ecuProgrammingInfo);
            return(ecuProgrammingInfo);
        }
示例#6
0
 public CombineInputUI(CombineInputs CombineInput, ECU ecu, Serial serial)
 {
     InitializeComponent();
     this.CombineInput           = CombineInput;
     this.ecu                    = ecu;
     this.serial                 = serial;
     this.DataContext            = CombineInput;
     targetActionCmb.ItemsSource = Enum.GetValues(typeof(TARGET_ACTION));
     index1Cmb.ItemsSource       = Enum.GetValues(typeof(INPUT_SOURCE));
     index2Cmb.ItemsSource       = Enum.GetValues(typeof(INPUT_SOURCE));
     operationCmb.ItemsSource    = Enum.GetValues(typeof(OPERATIONS));
     cutomtree.draw(ecu, CombineInput.SelectedOutputs);
 }
示例#7
0
        public List <Mod> GetValidMods(ECU d)
        {
            List <Mod> tm = new List <Mod>();

            foreach (Mod m in AvailableMods)
            {
                //TODO: When a mod is loaded, detect "FFFFFFF" CALID!!!
                if (m.InitialCalibrationId == d.CalId && m.TryCheckApplyMod(d.FilePath, d.FilePath + ".temp", true, false))
                {
                    tm.Add(m);
                    Trace.WriteLine("Loaded Mod: " + m.FileName);
                }
                else if (m.ModIdent == d.CalId && m.TryCheckApplyMod(d.FilePath, d.FilePath + ".temp", false, false))
                {
                    tm.Add(m);
                    Trace.WriteLine("Loaded Mod: " + m.FileName);
                }
            }
            return(tm);
        }
示例#8
0
 public void setECU(ECU ecu)
 {
     if(ecu == ECU.TRIONIC8)
     {
         tbVIN.Show();
         cbCab.Show();
         cbSAI.Show();
         cbOutput.Show();
         tbTopSpeed.Show();
         tbE85.Show();
         tbOilQuality.Show();
         cbBiopower.Show();
         cbClutchStart.Show();
         comboBoxDiag.Show();
         comboBoxTank.Show();
     }
     else if(ecu == ECU.MOTRONIC96)
     {
         tbVIN.Hide();
         cbCab.Hide();
         cbSAI.Hide();
         cbOutput.Hide();
         tbTopSpeed.Show();
         tbE85.Hide();
         tbOilQuality.Hide();
         cbBiopower.Hide();
         cbClutchStart.Hide();
         comboBoxDiag.Hide();
         comboBoxTank.Hide();
     }
     else if(ecu == ECU.TRIONIC7)
     {
         tbVIN.Hide();
         cbCab.Hide();
         cbSAI.Hide();
         cbOutput.Hide();
         tbTopSpeed.Hide();
         tbE85.Show();
         tbOilQuality.Hide();
         cbBiopower.Hide();
         cbClutchStart.Hide();
         comboBoxDiag.Hide();
         comboBoxTank.Hide();
     }
 }
示例#9
0
        /// <summary>
        /// Cleans up connections and resources
        /// </summary>
        public override void Cleanup()
        {
            try
            {
                m_ECU = ECU.TRIONIC8;
                tmr.Stop();
                MM_EndPeriod(1);
                logger.Debug("Cleanup called in Trionic8");
                //m_canDevice.removeListener(m_canListener);
                if (m_canListener != null)
                {
                    m_canListener.FlushQueue();
                }
                if (canUsbDevice != null)
                {
                    if (canUsbDevice is LPCCANDevice)
                    {
                        LPCCANDevice lpc = (LPCCANDevice)canUsbDevice;
                        lpc.disconnect();
                    }
                    canUsbDevice.close();
                    canUsbDevice = null;
                }
            }
            catch (Exception e)
            {
                logger.Debug(e.Message);
            }

            LogManager.Flush();
        }