public DefinitionEditor(SharpTuner st) { sharpTuner = st; InitializeComponent(); //When this initializes, check for existing device and auto-select //If no device, default to all definitions //TODO: handle ROM VS RAM }
public DefinitionEditor(SharpTuner st) { sharpTuner = st; InitializeComponent(); //When this initializes, check for existing device and auto-select //If no device, default to all definitions //TODO: handle ROM VS RAM }
private void buttonSave_Click(object sender, EventArgs e) { if (checkBox1.Checked && SharpTuner.AvailableDevices.DefDictionary.ContainsKey(comboBoxCopyDef.SelectedItem.ToString())) { SharpTuner.AvailableDevices.DefDictionary[comboBoxCopyDef.SelectedItem.ToString()].Populate(); def.CopyTables(SharpTuner.AvailableDevices.DefDictionary[comboBoxCopyDef.SelectedItem.ToString()]);//copy tables } //Save the definition XML try { def.xRomId = XElement.Parse(textBoxDefXml.Text); def.ParseRomId(); def.include = comboBoxIncludeDef.SelectedValue.ToString(); StringBuilder path = new StringBuilder(); path.Append(SharpTuner.EcuFlashDefRepoPath + "/"); if (def.CarInfo.ContainsKey("model") && def.CarInfo["model"] != null) { path.Append(def.CarInfo["model"].ToString()); if (def.CarInfo.ContainsKey("submodel") && def.CarInfo["submodel"] != null) { string s = " " + def.CarInfo["submodel"]; path.Append(s); } path.Append("/"); } string dirpath = path.ToString(); path.Append(def.internalId.ToString() + ".xml"); if (!Directory.Exists(dirpath)) { Directory.CreateDirectory(dirpath); } else if (File.Exists(path.ToString())) { DialogResult dialogResult = MessageBox.Show("Definition already exists at " + path.ToString() + System.Environment.NewLine + "Overwrite it??", "Warning", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.No) { MessageBox.Show("Save definition aborted"); return; } } def.defPath = path.ToString(); def.ExportXML(); MessageBox.Show("Successfully saved definition to " + def.defPath); SharpTuner.PopulateAvailableDevices(); this.Dispose(); } catch (Exception er) { MessageBox.Show("Error: " + er.Message); return; } }
/// <summary> /// Constructor /// </summary> /// public ECU(SharpTuner st, string fPath) { sharpTuner = st; FileInfo f = new FileInfo(fPath); this.FileSize = f.Length; this.FileName = f.Name; this.FilePath = fPath; this.FileDirectory = fPath.Replace(f.Name, ""); TryOpenRom(fPath); if (this.CalId == null) { UndefinedWindow uw = new UndefinedWindow(sharpTuner, fPath); uw.ShowDialog(); TryOpenRom(fPath); } }
public UndefinedWindow(SharpTuner st, string f) { sharpTuner = st; InitializeComponent(); filePath = f; }
public MapToDef(SharpTuner st) { sharpTuner = st; InitializeComponent(); }
public MapToDef(SharpTuner st) { sharpTuner = st; InitializeComponent(); }
public UndefinedWindow(SharpTuner st, string f) { sharpTuner = st; InitializeComponent(); filePath = f; }